Question: 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.

PLZ HELP JAVA. Main class is : import java.util.Scanner; /** * TestTimeis 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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!