You will develop a class named kitchentimer this is the


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

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: You will develop a class named kitchentimer this is the
Reference No:- TGS01702082

Expected delivery within 24 Hours