Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions

Question

=+1. What is the brand's character or personality?

Answered: 1 week ago