Question: Integers numScore 1 and numScore 2 are read from input. If numScore 1 is less than 2 0 , then output numScore 1 is less

Integers numScore1 and numScore2 are read from input.
If numScore1 is less than 20, then output "numScore1 is less than 20."
If numScore2 is less than or equal to 40, then assign numScore2 with 8.
Otherwise, output "numScore2 is greater than 40."public class NumberComparisons {
public static void main (String[] args){
Scanner scnr = new Scanner(System.in);
int numScore1;
int numScore2;
numScore1= scnr.nextInt();
numScore2= scnr.nextInt();
if (numScore1<20){
System.out.println("numScore1 is less than 20.");
} else if (numScore2<=40){
numScore2=8;
} else {
System.out.println("numScore2 is greater than 40.");
}
System.out.println("numScore2 is "+ numScore2+".");
}
}

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!