Having issues with the questions and getting it to work in


Question:Having issues with the following questions and getting it to work in a java format using NetBeans IDE

Question 1A. a class that will hold the information about a clock, called Clock. You need to keep minutes, hours and seconds in military time (24-hour) format. Include member functions that will setTime ( this will set the hours, minutes and seconds of the clock), getHours (return the hours), getMinutes (return the minutes) and getSeconds (return the seconds). Another method printTime which will print the time out like this 03:13:09 (hours:minutes:seconds). Overloaded constructors that will take in hours, minutes and seconds or the default constructor that will take in nothing and set hours, minutes and seconds all to 0.
Your class should also include the following methods

incrementSeconds() //A method to increment the time by one second. //The time is incremented by one second. // If the before-increment time is // 23:59:59, the time is reset to 00:00:00.
incrementMinutes() //A method to increment the time by one minute. // The time is incremented by one minute. // If the before-increment time is // 23:59:53, the time is reset to 00:00:53.
incrementHours() //A method to increment the time by one hour. // The time is incremented by one hour. // If the before-increment time is // 23:45:53, the time is reset to 00:45:53.

Question 1B. Show possible calls to do the following
- a clock that is set to 9:0:0
- another clock that is set to 9:30:20
- Add one hour to the first clock
- Add 30 minutes to the second clock

Question 2A. Using your clock class, a child class, ClockChild. a constructor that calls the parent's default constructor and an overloaded constructor that takes in hours, minutes and seconds and sets the member variables accordingly. a printTime method, for the child. Now it will take in a parameter called typeOfClock. This will be an integer that will be either 12 or 24. This tell the function how to print the time, either in military time (the parents type, call the parent method) or in normal type (12-hour) 11:30pm or 9:09am.

Question 2B. Show calls to instantiate two objects. One of the parent type, with the time set to 23:30:30 and one of the child type with the same time set. Show a call to printTime, using both objects

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Having issues with the questions and getting it to work in
Reference No:- TGS02361036

Now Priced at $20 (50% Discount)

Recommended (94%)

Rated (4.6/5)