Question: Integers numScore 1 and numScore 2 are read from input. Write one if statement and one if - else statement: If numScore 1 is less

Integers numScore1 and numScore2 are read from input. Write one if statement and one if-else statement:
If numScore1 is less than or equal to 40, then output "numScore1 is less than or equal to 40."
If numScore2 is greater than or equal to 30, then assign numScore2 with 4.
Otherwise, output "numScore2 is less than 30."
End each output with a newline.
import java.util.Scanner;
public class NumberConditions {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
int numScore1;
int numScore2;
numScore1= scnr.nextInt();
numScore2= scnr.nextInt();
/* Your code goes here */
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 Programming Questions!