Zelaron Gaming Forum  
Stats Arcade Portal Forum FAQ Community Calendar Today's Posts Search
Go Back   Zelaron Gaming Forum > The Zelaron Nexus > Science and Art > Tech Help

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next

 
java help
Reply
Posted 2009-05-11, 07:22 AM
ok i have java question i had to do this for class but it doesnt work.
they program ask user for their age and tell them if they can drink, drive or retire here what i have so far tell me what i am doing wrong.

import javax.swing.JOptionPane;
import java.util.Scanner;

public class Main {


public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);


//String name;


//name = JOptionPane.showInputDialog("what is your name");
//int names = Integer.parseInt(name);

String age = JOptionPane.showInputDialog("what is your age");
int ages = Integer.parseInt (age);

if (ages < 18){

System.out.println("you are too young to drive");
System.out.println(" you are too young to drink");
System.out.println("you are too young to retire");

}else if (ages >= 21){

System .out.println("you can drive");
System.out.println("you can go to bar and drink");
System.out.println("you can't retire yet");

}else if (ages >= 65){
System.out.println("you can drive");
System.out.println("you can drink");
System.out.println("you can retire now");

}
}
}
Old
Profile PM WWW Search
osmoses-jones is neither ape nor machine; has so far settled for the in-betweenosmoses-jones is neither ape nor machine; has so far settled for the in-between
 
osmoses-jones
 



 

Bookmarks

« Previous Thread | Next Thread »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules [Forum 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
JAVA help platnum Tech Help 2 2006-04-10 05:31 AM
Java and C#? pr0xy Tech Help 8 2005-02-08 07:13 AM
Programming Faq Demosthenes Tech Help 4 2004-10-25 04:43 PM
Java help Ganga Tech Help 12 2004-02-02 02:15 PM
Java Script help Dhelds Tech Help 0 2003-01-14 05:07 PM


All times are GMT -6. The time now is 01:19 PM.
'Synthesis 2' vBulletin 3.x styles and 'x79' derivative
by WetWired the Unbound and Chruser
Copyright ©2002-2008 zelaron.com
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.