Can't figure out my errors - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Can't figure out my errors

So I've done three different programs involving if statements and I can't figure out why I keep getting an error message "one or more projects are compiled with errors" on any of the programs. I've tested all three and each scenario and if i bypass the error they all run correctly. Here is one of the programs. Any help would be greatly appreciated thanks!

class Movies
{
public static void main (String []args)
{

Scanner scan = new Scanner(System.in);

int age, time;
double rate;
final double matineeChildren = 2.00;
final double regularChildren = 4.00;
final double matineeAdult = 5.00;
final double regularAdult = 8.00;

System.out.println("How old are you? ");
age = scan.nextInt();

System.out.println("What time is it? ");
time = scan.nextInt();

if (age < 12)
{
if (time < 1630)
rate = matineeChildren;
else
rate = regularChildren;

}

else
{
if (time < 1630)
rate = matineeAdult;
else
rate = regularAdult;
}

System.out.println("Your rate is " + rate);

}
}

Comments

Sign In or Register to comment.