Question: Write method in JAVA whileSwitch() to do the following: Return type of void Declare as static Empty parameter list Declare the following variables all of

Write method in JAVA whileSwitch() to do the following:

Return type of void

Declare as static

Empty parameter list

Declare the following variables all of primitive data type int

day

rain

In a while loop that loops for seven daysIn a switch that evaluates the variable dayIf case 0

Output to the console Sunday we got 1 inch of rain

Update variable rain to equal (rain + 1)

If case 1

Output to the console Monday we got 2 inches of rain

Update variable rain to equal (rain + 2)

If case 2

Output to the console Tuesday we got 3 inches of rain

Update variable rain to equal (rain + 3)

If case 3

Output to the console Wednesday we got 4 inches of rain

Update variable rain to equal (rain + 4)

If case 4

Output to the console Thursday we got 5 inches of rain

Update variable rain to equal (rain + 5)

If case 5

Output to the console Friday we got 6 inches of rain

Update variable rain to equal (rain + 6)

If case 6

Output to the console Saturday we got 7 inch of rain

Update variable rain to equal (rain + 7)

Default case

Output to the console that the value is not valid

Increment the looping variable day by 1

Output to the console how much rain was received in the past week

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!