Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-14-2008, 03:58 PM   PM User | #1
Bassmansam
New Coder

 
Join Date: Nov 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Bassmansam is an unknown quantity at this point
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");
}

}
Bassmansam is offline   Reply With Quote
Old 05-14-2008, 04:06 PM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Code:
if(a<18)
      // first block
elseif(a>18 && a<59)
    //second
elseif(a>59)
      //third
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:06 PM.


Advertisement
Log in to turn off these ads.