Hi sorry i took my time to come back after you
said it was okay.
Have gone back to step 1,
I have do my case menu in a loop as you said.
If i press 1 it ask for current airport
I type in Liverpool
I expect it to come back:
Liverpool Airport Total Flight Time 0
but where do i put current_airport = readLine in start Method
tried loads of ways or Am I going about It the Wrong way.
I will not finnish this assignment in time now as I have only
2 days to go till Monday. But I would like to learn at less to call
in methods case1 and case2.So at less i would have some understanding
for myself.
[code]
import java.io.*;
class AA
{
static
String fni[][] = { {"Paris" , "418", "Rome" , "55"},
{"Liverpool" , "121", "Copenhagen", "35"},
{"Liverpool" , "418", "Paris" , "50"},
{"Liverpool" , "553", "Frankfurt" , "55"},
{"Frankfurt" , "553", "Budapest" , "50"},
{"Amsterdam" , "121", "Madrid" , "65"},
{"Amsterdam" , "418", "Paris" , "35"},
{"Madrid" , "121", "Stockholm" , "90"},
{"Budapest" , "553", "Warsaw" , "30"},
{"Copenhagen", "121", "Amsterdam" , "35"},
{"Rome" , "418", "Amsterdam" , "60"} };
public static void main (String [] args) throws IOException
{
String destination="";
String current_airport = "";
int choice;
int FlightTime = 0;
do
{
choice = menu();
switch (choice)
{
case 1: current_airport = start();break;
case 2: break;
case 3: break;
case 4: break;
default:System.out.println("You entered an invalid number");
}
}
while (choice >0 && choice < 5);
}
static int menu()throws IOException
{
System.out.println("=============================================");
System.out.println(" No Wings Airline");
System.out.println("=============================================");
System.out.println(" ");
System.out.println(" 1. Start" );
System.out.println(" 2. Info" );
System.out.println(" 3. Fly" );
System.out.println(" 4. Exit" );
System.out.println(" ");
System.out.print("Please select one of the options: ");
String line;
int choice;
BufferedReader input = new BufferedReader( new InputStreamReader(System.in));
line = input.readLine();
choice = Integer.parseInt( line );
return choice;
}
static String start()throws IOException
{
int FlightTime = 0;
System.out.print("Please enter the Current Airport: ");
String line;
BufferedReader input = new BufferedReader( new InputStreamReader(System.in));
line = input.readLine();
return line;
}
// current_airport = readLine
// System.out.print(current_airport+ "Airport" + FlightTime);
}
[\code]
thanks
if you can get me stared
Lindsey
Ps Sorry if I should have started a new
thread but i was hoping
you guys were still watching for me to come back