Question: i need help with how the code should look Write AlarmclockController::add ours This method will add some number of hours to the controller's clock. It

i need help with how the code should look  i need help with how the code should look Write AlarmclockController::add

Write AlarmclockController::add ours This method will add some number of hours to the controller's clock. It will roll-over" if the number of hours increases past 23. For example, if the clock currently has an hour of 22 and we call addHours (5), then the clock's hour data member will become 3. The Alarm Clock class is already programmed to perform the roll-over, we simply have to call its increment Hours() method the appropriate number of times. 9. In AlarmClockController, write the method a specification: a description: Adds the given number of hours to the clock b. precondition hours > 0 c.@postcondition getclock().getHours () -- get clock().getHours (@prev + hours 24 d. @param hours with a description of the number of hours to add 10. Next write the header for the addHours () method. It should: a. be public b. return nothing (i.c., void) c. take a single parameter, named hours, of type int 11. Complete the method's body: a. Enforce the precondition: write an if-statement that throws a new IllegalArgumentException if hours is less than 0 b. Write a for-loop that starts a counter at 0, has a loop condition such that the count is strictly less than hours, and increments the counter by one every iteration. In other words, the loop will execute one iteration for every number we are adding, e. In the loop body, call increment Hour () on the theClock data member 12. Uncomment the tests in edu.westga.cs1301.project1.test.alarmclockcontroller.TestAddio urs and run the tests Write AlarmclockController::addMinutes 0 13. Repeat the previous section, this time to write an addMinutes() method that adds some number of minutes to the clock. This method must, however, increment the hour if and when the minutes roll-over. The Alarmclock class will ensure the minutes roll-over, but will not increment the hour when that happens. Be sure to follow the same development steps outlined for addHours) above. When you have written this method, uncomment and run the tests in TestAddToMinutes class. Fox any error in your AlarmClockController class that are detected

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!