Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLZ HELP JAVA. Main class is : import java.util.Scanner; /** * TestTime is a program which is designed to test the user implemented * MyTime()

PLZ HELP JAVA.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Main class is :

import java.util.Scanner;

/** * TestTime is a program which is designed to test the user implemented * MyTime() class created by the studentes in CS%141. *

Assignment #22 * * @author Michael A. Wood * @version 1.0 */ public class TestTime { private static Scanner x; public static void main(String[] args) { // Define the scanner for pausing. x = new Scanner(System.in); System.out.println("Part 1 : Do the constructors work?"); MyTime[] list = new MyTime[5]; list[1] = new MyTime(8,30); list[2] = new MyTime(12,45); list[3] = new MyTime(18,59); list[4] = new MyTime(4,30, true);

try { list[0] = new MyTime(78,15); } catch(IllegalArgumentException e) {

System.out.println("Good Job throwing the exception"); System.out.println("The error message is : " + e); list[0] = new MyTime(0,15); } System.out.println("Press enter to continue"); x.nextLine(); System.out.println("Part 2: Does toString() work correctly?"); System.out.println("Do they print correctly?");

for (int i = 0; i

System.out.println(); System.out.println("Press enter to continue"); x.nextLine(); System.out.println("Part 3: Does addTime() work?"); System.out.println(); MyTime t0 = new MyTime(23, 30); MyTime t1 = new MyTime(11, 55); t0.addTime(30 + 11 * 60); t1.addTime(20); System.out.println("Start : " + t0 +" to Finish : "+t1); x.nextLine(); System.out.println("Part 4: Does tick and findDifference work correctly?"); System.out.println(); for(int i = 0; i CS141 PROGRAMMING ASSIGNMENT #22 MY TIME OVERVIEW This program primarily focuses on the implementation of an object to a given specification/contract. Your deliverable will be to turn in single MyTime.java file that is written under the specifications below. You will be proved with a TestTime.java that you can use for testing. PROGRAM DESCRIPTION You will be writing an object to keep track of the time of day, however you will be using two different systems. Internally/privately you will keep track of the time using the military 0:00 23:59 by storing the hours and minutes as integers. However when you print off the time you will be using the classic 12:00 11:59 including the am/pm designation. YOUR INSTRUCTIONS You will write the following class, implementing the necessary methods as appropriate. MYTIME() The MyTime class will be your primary class to contain a particular time. interior private int fields to keep track of the hours and the minutes. It should have two

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago