Okay so my Java teacher isn't very good, and i'm kind of flying solo here.
He gave us this project, and one part of the project is throwing up a JOptionPane which allows the user to put input a number which correlates to a specific car.
For example
How do I pass on Camaro to the next variable instead of the number 1.
Any help is greatly appreciated. Thanks! If you need any more details just ask.
So if the user types 3... the variable chosen shows 3? well then why not have an if else statement to set the appropriate string name depending on whats selected :
String variable;
if(joptionanswer==1){
variable="Camero";
} else if(joptionanswer==2){
variable="Mustang";
}
DavidKroukamp
Practically a Master Poster
693 posts since Dec 2011
Reputation Points: 282
Solved Threads: 169
"my Java teacher isn't very good" is a very bold, and probably inaccurate statement.
I asume you've heard of the if-else structure? if not, a switch statement could help out as well.
stultuske
Posting Sensei
3,137 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 433