Question: Assume the int variable dayOfWeek has some value, and that it follows this rule: 1 = Monday 2 = Tuesday 3 = Wednesday 4 =

Assume the int variable dayOfWeek has some value, and that it follows this rule:

1 = Monday

2 = Tuesday

3 = Wednesday

4 = Thursday

5 = Friday

6 = Saturday

7 = Sunday

Declare a String variable called schedule and write a switch statement that gives schedule a different value based on the day of the week. For Monday, give it the value Gym in the morning." For Tuesday give it the value Class after work." For Wednesday, give it the value

Meetings all day." For Thursday give it the value Work from home." For Friday, give it the value Game night after work." For Saturday and Sunday, give it the value Free!" This should also be the default value.

Starting code:

//Assume this can have any value from 1 to 7:

int dayOfWeek = 1;

//TODO: declare a String variable called schedule.

//TODO: write a switch statement that give schedule a different

//value for each day of the week based on the dayOfWeek variable.

//Dont forget to "break" after each case, and dont forget to

//provide a default case!

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!