View Full Version : Simple program help

05-14-2008, 04:58 PM
Hi guys im new to Java and just need a bit of help with a program i am making

What i have is a program that lets the user enter 2 numbers the first number being there age and the second number is the amount of tickets required ,
i have 2 age groups so far one for ages less than 18 and one for ages greater than 59 i need a 3rd age group for ages between 18 and 59 and this is where im getting stuck, here is my code below .

class numbaz
public static void main(String[] args)
int a,b,c,d,e;
a= Integer.parseInt(args[0]) ;
b= Integer.parseInt(args[1]);
c= 18;
d= 10;

if (a<18)

System.out.println("The cost is " + d*b + "pounds");

else if (a>59)

System.out.println("The cost is " + c*b+ " pounds");


05-14-2008, 05:06 PM
// first block
elseif(a>18 && a<59)