Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions

Question

What do you think of Genjis project?

Answered: 1 week ago