am trying to create a digital clock. However, I have ran into some issues, I am trying to create a method called incrementMinutesBy() that follows the following specification: /** * Advances the entire clock by the given number of minutes * * @precondition minutes >= 0 * @postcondition the clock has moved forward by the appropriate * number of minutes * * @param minutes the number of minutes to add */ I also want to make sure that this method does 2 things: 1. The final this.minutes will be the sum of the previous this.minutes and the parameter, modulo the number of minutes in an hour. 2. The final this.hours will be the sum of the previous this.minutes and the parameter, divided by the number of minutes in an hour. I can share my code whenever necessary
I am trying to create a digital clock. However, I have ran into some issues, I am trying to create a method called incrementMinutesBy() that follows the following specification:
/** * Advances the entire clock by the given number of minutes * * @precondition minutes >= 0 * @postcondition the clock has moved forward by the appropriate * number of minutes * * @param minutes the number of minutes to add */
I also want to make sure that this method does 2 things:
1. The final this.minutes will be the sum of the previous this.minutes and the parameter, modulo the number of minutes in an hour.
2. The final this.hours will be the sum of the previous this.minutes and the parameter, divided by the number of minutes in an hour.
I can share my code whenever necessary
We need to write a function to update minutes and hours for incrementMinutesBy() function.
Step by step
Solved in 2 steps