Develop a class named kitchentimer

Assignment Help JAVA Programming
Reference no: EM131299382

Program- Kitchen Timer

This assignment goes a little beyond simply modifying an existing Bluej project. While there is considerable similarity to the ClockDisplay example we have been working with, there are some distinct differences. While you will no doubt find much of the code from ClockDisplay and NumberDisplay informative, your code here will be different.

The goal is a simple Kitchen Timer. There are only two things a user can do to a timer:

1. Set it, given a number of minutes and seconds.
2. Start it, after which the timer will begin counting down.

Once the timer is started, it will display the time, which will count down each second that passes.

Flashing Finish: When the time expires, the clock display will alternate between "DONE!" and "00:00", changing each second, for a total of 10 seconds. After that, the display should return to "--:--" and your program should stop running.

DisplayWindow Class Provided

First, you may use the DisplayWindow class from the better-clock project. When a new DisplayWindow object is created, a window appears that can display a string of up to nine characters. The default display is "--:--". A method named "setText" is provided to change the string being displayed.

Part I: KitchenTimer Class

You will develop a class named "KitchenTimer". This is the first class you will be developing from scratch. The class will have two fields, one to track the minutes remaining and another to track the seconds remaining. Note that you may use (and modify) the NumberDisplay class from the better-clock project, but you are not required to. The alternative is to simply use integer fields. The choice is up to you. In addition to those two fields, you need to include a field of type DisplayWindow such as:

private DisplayWindow display;

The class will also have the following public interface:

1. A constructor with no parameters. The constructor should initialize both the minutes and seconds remaining to zero and it will create a new TimerDisplay object. If you used the field declaration above, the following line accomplishes this:

display = new DisplayWindow();

2. A method named "setTimer" that includes two integer parameters. This method should set the minutes remaining and the seconds remaining to the values passed as parameters. The method should also build a string to represent the new time and display that new time.

3. A method named "startTimer" that has no parameters. When this method is called, the timer should begin to count down, and should not stop until the time has expired. Then the text "DONE!" should be displayed, flashing on and off as described above. For each second that the clock counts down, your code will need to do the following:

a) Pause for approximately one second. You may use my "wait_a_litttle" method from the ClockDisplay class for this. Just include it as a private static method in your KitchenTimer class.

b) Decrement the time remaining. Note that you will have to handle the rollover of seconds, and unlike when incrementing, your code will need to make a decision to handle this correctly.

c) Build a string to represent the new time.

d) Display that string.

Don't forget to include code to display "DONE!" when time has expired.

IMPORTANT Notes and Advice

• No output from this program will go to the terminal window. Use the DisplayWindow object to display both the time and the string "DONE!".

• As always, start early!

Part II: Sports Clock

If you have ever been to a sporting event at a modern facility, you've probably noticed that when the time remaining is under one minute, the display no longer shows minutes and seconds, but rather minutes and tenths of seconds, and the clock counts down in tenths of seconds during that final minute. The format of the time also changes from mm:ss (example: "12:45") to ss.t, (example: "23.4").

Modify your program to make this happen on your timer. Try not to over-think this. It is probably useful to think of making the clock countdown a two-step process: 1) Count down until there is just one minute left, then 2) Count down the final seconds. Step 2 doesn't need to happen until step 1 is complete, and each of these steps can be handled in their own loop.

Extra Credit!

In the Resources area on Isidore, you will find a file named "ScrollingDone.mp4". If you download that file and double-click on it, you should see a video of a DisplayWindow object that provides an animated display of the string "--DONE!--" that scrolls into the window a total of 11 times, stopping the last time in the middle. For 6 bonus points, make your Kitchen timer end this way, instead of the flashing "DONE!" described above.

Attachment:- Display_Window.rar

Reference no: EM131299382

Questions Cloud

Identify how would you describe your communication style : How would you describe your communication style? Describe a situation in which effective interpersonal communication skills contributed to your success.
Write an business report about an aspect of the company : Develop a research question to answer about the company that combines your discipline/concentration with strategic management.
Firm profit-maximizing level of output : The firm estimates the probability of the new regulation being enforced is 0.5. Find the firm's profit-maximizing level of output. Round your answer to one decimal.
Does this study really provide anonymity or just confidental : They can learn the results of the test by telephone, still without giving their name. Does this practice offer anonymity or confidentiality?
Develop a class named kitchentimer : You will develop a class named "KitchenTimer". This is the first class you will be developing from scratch. The class will have two fields, one to track the minutes remaining and another to track the seconds remaining.
Define a buffer and explain how a buffer works : On the basis of your research, respond to the following: Define a buffer and explain how a buffer works. Analyze and explain the buffer system in buffered aspirin (carboxylic acid)
Provide an overview of new web-based organization plans : Provide an overview of the new Web-based or Internet network the organization plans to implement. Prepare an overview of the security requirements for the network.
Would revealing the sponsor to respondents bias the poll : The standards accepted by polling organizations also require giving respondents the name and address of the organization that carries out the poll. Why do you think this is required?
Describe understanding of us public health system : In an opening paragraph describe your understanding of U.S. public health system using course material - In a second paragraph discuss how two of the module activities address different aspects of the three core functions of public health (assessme..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Calculate the maximum data rate in mb/second

b)How much cylinder skew is needed for an Oceangate disk operating at 20,000 rpm(new series for the Christmas promotions) which has a seek time of 0.5 milliseconds? This disk has 800 sectors of 512 bytes each on each track.

  Write an application that uses an array to store

Write an application that uses an Array to store 10 messages of type String - You will store this Array with 10 messages

  Write a recursive method to compute the following series

Write a recursive method to compute the following series.

  Computes the raise and new salary for an employee

Computes the raise and new salary for an employee. Complete the following program to determine the raise and new salary for an employee by adding if ... else statements to compute the raise

  Write a method for the purse class

Write a method for the Purse class public boolean sameContents(Purse other) that checks whether the other purse has the same coins in the same order.

  Use inheritance to read, store, and print questions for test

use inheritance to read, store, and print questions for a test. First, write an abstract class

  Implement a java program that reads phone numbers

Implement a Java program that reads phone numbers, and for each phone number, it displays the phone number's three components - country code, area code, and local number.

  Example of a problematic programming situation or scenario

Suggest one (1) example of a problematic programming situation or scenario that the use or implementation of a sequence structure could resolve

  What is printed out by the following code

What is printed out by the following code

  A class is a blueprint for an object

A class is a blueprint for an object. A class may have a default constructor, a constructor with arguments, accessor methods, mutator methods, public fields, and private fields.

  Write a void function this passed three integers

1. Write a void function this passed three integers by reference. The function should rearrange the parameter values so that the first parameter will get the smallest value; the second parameter the middle value; and the third parameter the largest v..

  Enhance the test score applicaion

Enhance the Test Score applicaion so it uses a "while" or a "do-while" loop plus a for loop - Change the while statement to a do-while statement, andtest this change. Does this work any better than the while loop?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd