So im kind of new to coding, im doing some school work where im supposed to make a simple script to calculate the cost of a movie for each person, for example, a senior pays $10, a child pays $9, and others pay $12. However, I keep getting 2 variables at the end of the output. is there anything here that could fix this problem? Heres my code.
import java.util.*;
public class MovieCost
{
public static void main(String [] args)
{
Scanner myInput = new Scanner(System.in);
String name;//user's name
int age;//user's age
//Get user's name and age
System.out.println("What is your name?");
name = myInput.nextLine();
System.out.println("How old are you?");
age = myInput.nextInt();
if (age>=65)//check if senior ticket
{
System.out.println("The movie will cost $10");
}
else //if not a senior ticket, check if child ticket
{
System.out.println("The movie will cost $12");
}
if (age<=12)//check if child ticket
{
System.out.println("The movie will cost $9");
}
else //if not a child ticket, full adult price
{
System.out.println("The movie will cost $12");
}
}//end main
}//end class