- 1
Java - Nested If statements
I don’t know what I’m doing wrong. The prompt says to return “Gift Card” after multiple inputs. import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); int purchases = read.nextInt(); //complete the code if(purchases > 15000) { if(purchases > 30000) { System.out.println("Gift card"); } else { System.out.println("Gift card"); } } } }
4 odpowiedzi
0
In any case, do you need Gift Card?
Check your conditions again...
>30000 is also >15000 .
I think it asking in-between?
0
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner read = new Scanner(System.in);
int purchases = read.nextInt();
if(purchases > 15000){
System.out.println("Gift card");
//complete the code
if (purchases > 30000)
System.out.println("Gift card");
}
}
}
0
if(purchases > 15000 ){
System.out.println("Gift card");
if(purchases > 30000){
System.out.println("Gift card");
}
}
- 1
I ran out of space but the goal is to print Gift Card if the input is > 15000 and > 30000 but I can’t seem to get it to pass for > 30000