Problem 24

Weekday Name

I have provided a function that is supposed to return the name of a day of the week given the day number. Download the file and modify the code in the weekdayName method only.

Files Needed

WeekdayName.java

Use if,else if, else to complete it according to the following table:

Number	Day of week
1	Sunday
2	Monday
3	Tuesday
4	Wednesday
5	Thursday
6	Friday
7	Saturday
0	Saturday
anything else	"error"

What You Should See

Weekday 1: Sunday
Weekday 2: Monday
Weekday 3: Tuesday
Weekday 4: Wednesday
Weekday 5: Thursday
Weekday 6: Friday
Weekday 7: Saturday
Weekday 0: Saturday

Weekday 43: error
Weekday 17: error
Weekday -1: error

Today is a Wednesday!

◄ 23: Else And If 25: How Old Are You, Specifically? ►



Adapted from ProgrammingByDoing.com
©2013 Graham Mitchell

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.