Can't figure out my error - Programmers Heaven

Howdy, Stranger!

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


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 error

bigtrouble187bigtrouble187 Posts: 2Member
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(;

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;
rate = regularChildren;


if (time < 1630)
rate = matineeAdult;
rate = regularAdult;

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



  • hello_worldhello_world Posts: 2Member
    Your program seems to be fine. Are you using and IDE, like eclipse? If so, my guess is there are errors in programs in other projects. Try compiling this java code alone at command prompt and run it. You won't see the error, which would imply that this program is fine.
Sign In or Register to comment.