Loading...
Loading...
Loading...
Students count the days to the weekend. Declare enum Day with MONDAY to SUNDAY in order. For each day, print weekend for Saturday and Sunday, otherwise how many days are left until Saturday.
Use the positions of the constants: Saturday's position minus the day's position.
DAY: weekend, DAY: 1 day to Saturday or DAY: n days to Saturday.Example
Input
3 MONDAY FRIDAY SUNDAY
Output
MONDAY: 5 days to Saturday FRIDAY: 1 day to Saturday SUNDAY: weekend
Monday is 5 days before Saturday, Friday only 1.
Try the problem first. Open one hint at a time.
Day.SATURDAY.ordinal() - d.ordinal() is the number of days left.
Print day (no s) when the answer is 1.
Write your Java code, run it on the examples and submit it to hidden tests.
Solve in the editor