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

  Develop a queue class

Print-out of the text file that contains your restaurant information and develop a Queue class. Hint: Check out the sample Queue java source files included with this assignment. Declare a class Party to hold one party.

  Elements from a html document

Function test Count List Elements should simply retrieve an array of all list elements on the page and assert that their total count is 3.

  Array named peopletypes that can store a maximum

Define a 1-D array named peopleTypes that can store a maximum of 50 integer values that will be entered at the keyboard. Enter a series of 1's, 2's, 3's and 4's into the array, where a 1 represents an infant, a 2 represents a child, a 3 represents..

  Subtyping and binary methods

This question is about the relationship between subtyping and inheritance. Recall that the main principle associated with subtyping is substitutivity: If A is asubtype of B, then wherever a B object is required in a program

  Concept of operator overloading

This lab is to introduce students to the concept of operator overloading as member functions of a class. This will be done in the context of creating a class that will perform four basic mathematical operations on complex numbers

  Prepare a demo program

Design, and implement a class that will be used in a program that simulates a combination lock. The lock has a circular knob with the numbers 0 through 39 marked on the edge, and it has a three-number combination, which we will call x,y,z.

  Java program use breadth-first search closest broadcast

Write the java program which will use breadth-first search (which you implement as part of your program) to determine the closest broadcast vertex for each vertex in graph.

  Develop a java program that simulates the queues in a bank

Develop a java program that simulates the queues in a bank. Implement the event-driven simulation of a bank. A queue of arrival events will represent the line of customers in the bank.

  Write java applet for costco gas station

Write a java applet for costco gas station. The applet will first ask you whether you are a costco customer, then the grade of gas you want to use: grade 87, 89, or 91.

  Write a java program called numbers

Methods Lab   1. Write a Java program called Numbers that calls the following methods and displays the returned value: o Write a method called cubeIt that accepts one integer parameter and returns the value raised to the third power as an integer.

  Write java program which can perform given types operations

Write a Java program which can perform the following types of operations based on input provided by the user: Basic mathematical calculations: addition, subtraction, multiplication and division.

  How to get how to get the output

how to get the output of the java program.  Please explain in steps on how to get the output.

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