Write an if-else statement that if userTickets is greater than 5, executes award Points = 15 Else, execute award Points = user Tickets. Ex: If user Tickets is 14, then award Points = 15.
import java.util.Scanner;
public class App {
/** Main Method */
public static void main(String[] args) {
Scanner keyBoard = new Scanner(System.in); // Create a Scanner
System.out.print("Enter user tickets: ");
int userTickets = keyBoard.nextInt();
if (userTickets > 5) {
System.out.println("Award Points = 15");
} else {
System.out.println("Award Points = " + userTickets);
}
keyBoard.close();
}
}
Comments
Leave a comment