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

  Better with age

You and your roommates, all at least 21 years of age, have gotten hooked brewing your own beer from kits. You've made quite a few batches, each from a different mix,

  Complete bst implementation

Complete BST implementation: - Write methods for ImOrder, PreOrder and PostOrder Traversals - Write min() method - Write Successor () method - Extra Credit Implement Binary Heapusmg An&Y Node implementation

  Create a class rectangle with attributes length and width

Create a class Rectangle with attributes length and width, each of which defaults to 1. Provide member function that calculate and the area of the rectangle.

  Instantiate two savingsaccount objects

saver1 and saver2, with balances of $2000.00 and $3000.00, respectively (was trying to figure out the formula, what I have written so far is as follows, and I am trying to see if I missed something

  Creating mapreduce program to calculatingpi

Creating MapReduce program to calculatingpi, Step 1: Generate an input file to the Pi MapReduce program and Create a regular Java program which accepts two command line arguments

  Program to mimic a student information management system

Write a Java program to mimic a student information management system. The main entry page should have at least following options:

  Calculate the optimal position of the large pipeline

Your task is to calculate the optimal position (on the y-axis) of the large pipeline, so that the total length of all smaller pipelines is shortest

  Text file containing the data

This program should begin by asking the user for the name of a text file containing the data. Then read the data which will be a line containing the dimensions of a 2 dimensional array followed by a 2 dimensional array of ints. Then perform variou..

  Create a payroll program named calcpay

Create a payroll program named CalcPay that allows the user to enter two double values namely hours worked and hourly rate. After the user enters the rate and hours, the program should calculate the gross pay.

  Design the logic and write the rest of the program

Design the logic and write the rest of the program using a nested statement.  They are using JOptionPane.showInputDialog.

  The desired functionality is for your programs to input

the desired functionality is for your programs to input pairs of natural numbers as theyre entered by the user until

  Complete and fully test the class characteristic

Complete and fully test the class Characteristic that Exercise explains. Suppose a class Characteristic that will be used in an online dating service to assess how compatible two people are.

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