- 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 Respostas
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