Question: Java. (keep in mind the pictures are part of the same question) The following class, Digitalclock, is designed to display and manipulate a digital clock.
Java.
(keep in mind the pictures are part of the same question)
The following class, Digitalclock, is designed to display and manipulate a digital clock. The incomplete class declaration is shown below. public class Digitalclock Constructs a Digitalclock set at the specified hour and minute. @param hour the specified hour @param minute the specified minute public DigitalClock(int hour, int minute) /* implementation not shown / Advances the time on the DigitalClock by one minute */ public void advanceTime() { /* implementation not shown */ } / * @return true if this DigitalClock is defective, false otherwise public boolean isDefective() 1/* implementation not shown */) //There may be instance variables, constructors, and methods that are not 1/shown. +/ Consider the following class, Aliclocks, which stores and manipulates a list of Digitalclock objects. public class Aliclocks /** The list of digital clocks */ private List clocks; /** Advance the time by one minute on all the clocks. */ public void advanceTimeOnAll() in to be implemented in part (a) */ } /** Remove all defective clocks from the list. */ public void removeDefective () { /* to be implemented in part (b) */ } * Replace all defective clocks with a new clock set at 12:30, * that is, hours 12 and minutes 30. */ public void replaceDefective () A to be implemented in part (c) */ } //There may be constructors and methods that are not shown. a. Write the Aliclocks method advanceTimeOnAll, which advances the time by one minute on all the clocks in the ArrayList clocks, Complete the method advanceTimeOnAli below. /** Advance the time by one minute on all the clocks. / public void advanceTimeOnA110) b. Write the Aliclocks method removeDefective, which removes all defective clocks from the ArrayList clocks. Complete the method removeDefective below. /** Remove all defective clocks from the list. / public void removeDefective () c. Write the AllClocks method replaceDefective, which replaces each defective clock with a new clock set at 12:30. Complete the method replaceDefective below. Replace all defective clocks with a new clock set at 12:30, that is, hours 12 and minutes 30. public void replaceDefective) /* to be implemented in part (c) */ }