Write portions of java class that models a very simple clock

Assignment Help JAVA Programming
Reference no: EM131119586

Overview

You will be writing portions of a Java class that models a very simple clock. You will also be provided with two different "front ends" that use this same class as a plug-in - a simple program that loops through the time for a full hour of time, displaying each passing second on your screen, and a slightly more complex program that displays the time in a window and allows you to update it with a click of a button. If you have coded your clock class correctly, these two programs provided will just work when you run them.

Objectives

Practice with programming fundamentals
Variables - Declaration and Assignment
Primitive types
Branching: if-else if-else syntax, nested if-else syntax
Nested while loops
Methods - simple functions and procedures
Object-oriented programming
Works towards the following Course Goals:
Competency with using basic coding features of a high-level imperative programming language
Competency with writing computer programs to implement given simple algorithms
Familiarity with designing simple text-oriented user interfaces
Project 12 Description

This lab is structured differently than previous labs. For this lab you are provided with three Java files - Project12.java and ClockView.java hold code that you do not need to touch. You will only be writing code in the file SimpleClock.java. Create a new project named "Project 12" and import all three of these source code files into your project workspace. All three of these files must be in the same Project folder, and must all be in the same default namespace in your Eclipse workspace.

Project12.java
ClockView.java
SimpleClock.java

Open the SimpleClock.java file. In this file is a partial implementation of the SimpleClock class. You must fill in the code for the constructor, as well as for the methods set, tick and time, following the instructions provided for each of these methods in the comments for these methods.

When you think that you have them working, run the Project12.java program. You should see output like the following:

Clock starts at time: 12:00:00 AM

Clock has been set to time: 11:59:00 PM

TICK: 11:59:01 PM

TICK: 11:59:02 PM

TICK: 11:59:03 PM

TICK: 11:59:04 PM

TICK: 11:59:05 PM

TICK: 11:59:06 PM

TICK: 11:59:07 PM

... Many lines of output like the above ...

TICK: 12:58:58 AM

TICK: 12:58:59 AM

TICK: 12:59:00 AM

Clock finally reads: 12:59:00 AM

Once you have that working, try running ClockView.java. It should pop up a window with a midnight time showing and two buttons - Tick and Reset. The Tick button should increment the clock by one second, the reset button should set it back to midnight. Play with this interface to make sure it works as expected.

Reference no: EM131119586

Questions Cloud

Discuss why human resource management and the law : Even if you don't plan on being in HR, it is important for you to know the information from this chapter. Let's discuss why Human Resource Management (HRM) so important. Please pick a specific area, and indicate it in the subject line.
Describe the various types of financial intermediaries : Describe the various types of financial intermediaries, including the sources of their funds and the types of investments they make.
What is your total percentage return on this investment : Suppose that firms with unexpectedly high earnings earn abnormally high returns for several months after the announcement. This would be evidence of:
Describe the primary forms of established approaches : Describe the primary forms of established approaches to alternative dispute resolution, but ensure to also include the less well-known approach of victim/offender dialogue (also known as restorative dialogue).
Write portions of java class that models a very simple clock : You will be writing portions of a Java class that models a very simple clock. You will also be provided with two different "front ends" that use this same class as a plug-in - a simple program that loops through the time for a full hour of time.
How do money and capital markets differ : How do money and capital markets differ?
Makes the same product but with different capacities : A company has to decide among three processes that makes the same product but with different capacities, to implement next fall. The information on the processes are: The company estimated the demand to be between 700 and 1200 products. Using a graph..
Discuss best practices in patient care delivery : Discuss best practices in patient care delivery in healthcare organizations leveraging information and communication technologies in practice
What roles do financial middlemen and financial : What roles do financial middlemen and financial intermediaries play in the operation of the U.S. financial system? How do the two differ?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Programming using the java language

Programming using the Java language. The basic concepts of object-oriented programming. Topics used will include algorithmic logic, control structures, data and program design, objects and classes.

  Advantages and disadvantages of an arraylist

What are the advantages and disadvantages of an ArrayList? When should you use an ArrayList over a simple array

  Develop a reliable transfer protocol over udp

Develop a reliable transfer protocol over UDP. Focus on a Stop- and-Wait protocol.

  Write a program that starts a player off with a bank of $15

Write a program that starts a player off with a bank of $15.00.

  Java program to decide whether integer is perfect number

For example, 6 is a perfect number because 6 = 1 + 2 + 3. Write a Java program that decides whether integer is a perfect number.

  Java code using jframe

Write a Java code using JFrame. This code needs to manipulate 4 shapes(2 rectangles and 2 squares) in a 400x400 JFrame. This needs to manipulate the shapes in 3 different ways, using 3 different methods. One for translating a shape, one for proportio..

  Prompt the user for an int between an upper and lower

prompt the user for an int between an upper and lower boundary. reuse the validateinput method from project to validate

  Create a program that asks a user for a number

Create a program that asks a user for a number between 1 and 100, the program should then output to the user higher, lower, or correct, depending upon the input from the user and the random number assigned to the number to be guessed

  Sets a loop to find 10 random generated

Write a java code that 1) uploads a file 2) sets a loop to find 10 random generated words from the file and then search those words by a. IndexSequential Method b. indexBinary Method. then, report how much time both methods took.

  User enter a series of numbers

Design a java program with a loop that lets the user enter a series of numbers. The user should enter - 99 to signal the end of the series. After all the numbers have been enter been entered, the program should display the largest and smallest number..

  Provide a regular expression that shows the set of strings

Provide a regular expression that shows the set of strings over {a, b} thatcontain at least one b if its length is at least four.

  Write a program that displays a drawing popular hangman game

Write a program that displays a drawing for the popular hangman game, as shown in Figure 15.32(c). draws a sketch for the hangman game.

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