Kotlinlearncs.online LogoJava
Return to List

Solve: Alarm Clock

Imported By: Geoffrey Challen
/ Version: 2021.6.0

Given a day of the week encoded as 0=Sun, 1=Mon, 2=Tue, ...6=Sat, and a boolean indicating if we are on vacation, return a String of the form "7:00" indicating when the alarm clock should ring. Weekdays, the alarm should be "7:00" and on the weekend it should be "10:00". Unless we are on vacation. Then on weekdays it should be "10:00" and weekends it should be "off".

String alarmClock(int day, boolean vacation) {
return ""; // You may need to remove this starter code
}

Related Lessons

Stuck? You may find these lessons helpful: