if ( age < 13 )
Here is the program with the blank filled in correctly:
import java.util.Scanner;
public class BoxOffice
{
public static void main (String[] args)
{
Scanner scan = new Scanner( System.in );
int age;
System.out.println("Enter your age:");
age = scan.nextInt();
if ( age < 13 )
{
System.out.println("Child rate.");
}
else
{
System.out.println("Adult rate.");
}
System.out.println("Enjoy the show.");
}
}
Here is what happens for one run of the program:
int
and put into the variable age.
age < 13
is tested.21 < 13
is false.What does the program output if the user enters 11?