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

  What should a comment at the class level contain

How do you identify a comment so the Javadoc tool will recognize it and what should a comment at the class level contain?

  Java shape program console

Program is adequately documented. It's comments identifies its name, purpose, author and date. Throughout the code, comments and/or relevant component names should attempt to make the program understandable.

  Build application and activate the camera for android mobile

The proposed idea build application and activate the camera for android mobile and take picture and put animation on someone face

  Evaluate the average temperature for the month

Write a program that stores the daily temperatures for the month of April in an array name dailytemp. Evaluate the average temperature for the month and the count the number of days

  What are differences between instance and class variables

What are the differences between instance and class variables? What is an overloaded method?

  Define an enum type in the librarybook class

Define a class variable, totalTVs, whose purpose is to keep track of the total number of Television objects constructed during execution of a program that uses the Television class - Define an enum type in the LibraryBook class corresponding to the..

  Part - a1nbsp to compile and run a java source file

part - a1.nbsp to compile and run a java source file hello.java that contains a main method which of the following are

  What are mobile oss you have personally used explain the

write a 200- to 300-word short-answer response to the following bull what are mobile oss you have personally used?

  Description of routes and services

Write a method for finding a journey from one station to another using an algorithm that is specified below in this handout.

  Create a file that contains your favorite movie quote

Create a file that contains your favorite movie quote. Use a text editor such as Notepad, and save the file as quote.txt. Copy the file contents,

  Modify the factorial method with a recursive call

You may want to add such display capabilities to other recursion examples and exercises throughout the text.

  Modify the program to include an add button

These buttons should allow the user to perform the corresponding actions on the item name, the number of units in stock, and the price of each unit. An item added to the inventory should have an item number one more than the previous last item.

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