CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Java and JSP (http://www.codingforums.com/forumdisplay.php?f=54)
-   -   Simple program help (http://www.codingforums.com/showthread.php?t=139730)

Bassmansam 05-14-2008 03:58 PM

Simple program help
 
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");
}

}

abduraooft 05-14-2008 04:06 PM

Code:

if(a<18)
      // first block
elseif(a>18 && a<59)
    //second
elseif(a>59)
      //third



All times are GMT +1. The time now is 03:12 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.