0
Logical statements lab isn’t passing
My code is below, this is for the 13.1 practice labs import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); int population = 9955; read.nextInt(); int area = 7522; read.nextInt(); //Complete the code if (population < 10000 && area < 10000) System.out.println("small country"); } }
2 Antworten
+ 2
<population> and <area> should be read as input from Scanner <read>
int population = read.nexrInt();
int area = read.nextInt();
You are not reading any input when you should.
0
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner read = new Scanner(System.in);
int population = 9955;
int area = 7522;
// Read input from the user
population = read.nextInt();
area = read.nextInt();
// Complete the code
if (population < 10000 && area < 10000) {
System.out.println("small country");
} else {
System.out.println("large country");
}
}
}