Answered step by step
Verified Expert Solution
Question
1 Approved Answer
NEED THIS ASAP java Create a program called CustomClock. CustomClock should contain a default constructor (setting the time to 0:00:00, daylight savings time is off)
NEED THIS ASAP
java
Create a program called CustomClock. CustomClock should contain a default constructor (setting the time to 0:00:00, daylight savings time is off) and a constructor with arguments for hours, minutes, seconds and daylight_savings CustomClock should have the following attributes: Hours (int) (Range can only be 0 to 23) Minutes (int) (Range can only be 0 to 59) Seconds (int) (Range can only be 0 to 59) daylight_savings (boolean) And the following methods (Denoted as 'name: return type - description'): getHours(): int Returns the current hour. setMinutes(): int - Returns the current minute. getSeconds(): int - Returns the current second. setTime(int newHours, int newMinutes, int newSeconds): void - Sets the time to the given hour, minute, and second. If any of the presented values are out of acceptable range (see above), set the accompanying value to O instead. tick(): void Advance time by one second. If seconds reaches 60, set seconds to 0 and increment minutes by 1. If minutes hits 60, set minutes to 0 and increment hours by 1. If hours reaches 24, set hours to 0. toggleDLS(): void - Toggle daylight_savings, updating time as needed. If daylight_savings is changed from false to true, increment hours by 1. If daylight_savings is changed from true to false, decrement hours by 1. - It is highly recommended that you create a second class in order to test creating CustomClock objects, as well as running methods from CustomClock to ensure that they work correctly Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started