Results 1 to 5 of 5
Thread: selecting options in java
- 03-01-2013, 07:01 PM #1
Member
- Join Date
- Mar 2013
- Posts
- 22
- Rep Power
- 0
selecting options in java
Hi im new to the java language.
import javax.swing.JOptionPane;
public class TravelAgentSystem {
public static void main(String[] args) {
// Local variable declared
int selectValue;
// Main Menu is displayed
System.out.println("| Flight Travel Systems |");
System.out.println("|--------------------------|");
System.out.println("| Options: |");
System.out.println("| 1. Time |");
System.out.println("| 2. Price |");
System.out.println("| 3. Hotels |");
System.out.println("| 4. End |");
System.out.println("============================") ;
selectValue();
}
public static void selectValue()
{
int choice = -1;
while(choice < 0)
{
String input = JOptionPane.showInputDialog("Please select an option: ");
}
}
}
I want to make it so when i select an option such as 1, it will take me to a new option where i can display more infomation.
Anyone know how i can go about doing this?Last edited by beginnerprog; 03-01-2013 at 07:04 PM.
- 03-01-2013, 08:36 PM #2
Re: selecting options in java
Why do they call it rush hour when nothing moves? - Robin Williams
- 03-01-2013, 10:17 PM #3
Member
- Join Date
- Mar 2013
- Posts
- 22
- Rep Power
- 0
Re: selecting options in java
import javax.swing.JOptionPane;
public class TravelAgentSystem {
public static void main(String[] args) {
// Local variable declared
int selectValue;
// Main Menu is displayed
System.out.println("| Flight Travel Systems |");
System.out.println("|--------------------------|");
System.out.println("| Options: |");
System.out.println("| 1. Time |");
System.out.println("| 2. Price |");
System.out.println("| 3. Hotels |");
System.out.println("| 4. End |");
System.out.println("============================") ;
selectValue();
}
public static void selectValue()
{
int choice = -1;
while(choice < 0)
{
String input = JOptionPane.showInputDialog("Please select an option: ");
choice +=1;
if (input.equals("1")){
System.out.println("fdsfds");
}
else if (input.equals("2")){
System.out.println("ggfdgd " );
}
else if (input.equals("3")){
System.out.println("hgfdhgf " );
}
else if (input.equals("4")){
System.out.println("nhgdhd " );
}
else {
JOptionPane.showMessageDialog(null, "User error,please select an option");
choice-=1;
}
}
}
}
cheers
now im trying to make it so when i enter 1 i get a list of flights and choose a destination in which i can work out the estimated time
how would i go about doing this any ideas?
do i create a new class?Last edited by beginnerprog; 03-01-2013 at 10:43 PM.
- 03-02-2013, 09:34 AM #4
Re: selecting options in java
You could make a start by going through all the three links I already posted, and applying the knowledge you gain.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 03-02-2013, 12:34 PM #5
Member
- Join Date
- Jan 2013
- Posts
- 9
- Rep Power
- 0
Similar Threads
-
Finding the merged ranges in excel in a java program using jexcel Options
By srinivasany in forum New To JavaReplies: 1Last Post: 03-28-2012, 12:43 PM -
Why does my JAVA application/options flicker like this?
By 7hm in forum Advanced JavaReplies: 7Last Post: 08-12-2011, 05:54 PM -
Set Java Control Panel options via Command Prompt
By pguih in forum Advanced JavaReplies: 0Last Post: 05-09-2011, 04:24 PM -
Selecting every other array
By Rivy2112 in forum New To JavaReplies: 10Last Post: 10-11-2010, 10:39 PM -
problem with Java Vm options
By DonnieDarko in forum Advanced JavaReplies: 1Last Post: 11-21-2007, 03:22 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks