Question: Write a function named alarm _ clock. The function has two parameters. The first parameter is an integer named day and encodes the day of

Write a function named alarm_clock. The function has two parameters. The first parameter is an
integer named day and encodes the day of the week: 0=Sun, 1=Mon, 2=Tue, ...,6=Sat. The second
parameter is a boolean named vacation, and it is true when we are on vacation. The function returns
an integer that indicates when the alarm will ring. On weekdays (non-vacations), the alarm should ring
at 7 a.m., i.e., the function should return 7. On weekends (non-vacations) and vacations (weekdays), the
alarm should ring at 10 a.m, i.e., the function should return 10. On vacation (weekend), the alarm should
be off, i.e., the function should return -1.

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