Question: Using this format: / * * * Adds the given number of Minutes to the clock and adds an hour when minutes hits 6 0

Using this format:/*** Adds the given number of Minutes to the clock and adds an hour when minutes hits 60* @precondition minutes >=0* @postcondition getClock().getMinutes()== getClock().getMinutes()@prev + Minutes %60* @param minutes with a description of: the number of minutes to add */ public void addMinutes(int minutes){ if (minutes <0){ throw new IllegalArgumentException("Minutes can't be less than 0"); } for (int i =0; i < minutes; i++){ clock.incrementMinutes(); if (clock.getMinutes()%60==0){ clock.incrementHour(); }}} Write an addSeconds() method that: a. has an appropriate method specification b. returns nothing c. takes one parameter: the number of seconds to add. The number of seconds should be at least zero. d. adds that number of seconds to the clock. If the seconds rolls over it should increase the minutes by one. If the minutes roll over, it should increase the hours by one.

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 Programming Questions!