id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

soweigel@smsd.org > alarm
prev  |  next  |  chance

Given a day of the week encoded as 0=Sun, 1=Mon, 2=Tue, ...6=Sat, 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". If the day is not an int from 0 to 6, return "error". You must use a switch statement to decide the alarm time.


alarm(0) → "10:00"
alarm(3) → "7:00"
alarm(7) → "error"

...Save, Compile, Run (ctrl-enter)

public String alarm(int day) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 100

Copyright Nick Parlante 2017 - privacy