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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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