Question: 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

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!