Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Read each question and type your answer in the textbox below. Assume a properly formatted program. int num; Scanner sc = new Scanner ( System

Read each question and type your answer in the textbox below.
Assume a properly formatted program.
int num;
Scanner sc = new Scanner(System.in);
num = sc.nextInt();
switch (num)
{
case 7:
case 6:
System.out.print("Green");
break;
case 5:
case 3:
System.out.print("Yellow");
break;
case 2:
case 1:
System.out.print("Red");
break;
default:
System.out.print("What?");
break;
}

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_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

Distinguish between poor and good positive and neutral messages.

Answered: 1 week ago

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago