Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!

Lindsey Ship

Greenhorn
+ Follow
since Feb 07, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Lindsey Ship

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
17 years ago
Well you guys,
you can have some peace , I give up I can't expect you to take me by the hand.
But the more changes i make the more errors I get with trying to asign method to case i don't know if i am coming or going.
I know you are right in what you say but i have not got the brains to impelement it. I am digging
my self deeper and deeper in trouble.
Also i understand what you say about max(length)
but not allowed a fixed array.
I will leave you know to help people who know what their doing
take care it was fun while it lasted
Lindsey
xxxx
17 years ago
Thanks again Junilar
I will attempt what you said
Lindsey
17 years ago
thanks you guys,
but you have lost me, i am a total new comer to java, will have to go back to reading books before i can even understand your answers.
i know you mean well and trying to get me started
on the right track. But i guess i am not up to it
at this moment in time,
so it back to books for me.
take care all of you
Lindsey
17 years ago
Thanks for saying i could come back.
I better tell you the requirments then you can stop me
before i waste another week of lack of sleep.
I have to use a menu of some sort for following 4 commands
--------------------------------------------------------------
Start:
to enter current airport by name and resets journey time to zero
info:
to display current journey time so far, name of airport and
flight numbers.
fly:
ask for a fight number, if number is that of the plane flying
from current airport.It then checks where the plane is fying to and
makes that the current airport and adds the journey time to the flight
time. But if no plane matches number entered display a error message
but make no other changes.

Exit: Stops and exits program
---------------------------------------------------------------
That is the requirements above, as you can see i have done
Start: and info.
Info meets the requirements but i think it is silly they don't ask
for destination to be displayed with flight number.
Also the way i search for planes is that the right way
info[0],info[1],info[2] as suggested by teacher. As if you look at my
earlier code I got all the same information but using [i] only
We can use any array

Here is the code so far


Is my code right upto know, not asking any one to do my work
but i don't know where to start on a method to make the destination
airport current. also is it a seperate method for updating the flight time.
If it is I will try to have a go of that one myself, if not i am up a
creek with out a paddle .
Sorry if this post was long, but I wanted you to have
all the facts what i am suppose to do
Thanks
Lindsey
[ February 13, 2003: Message edited by: Marilyn de Queiroz ]
17 years ago
HI Junilu
Thanks for your help, you was spot on with what my code has to do.
But after a full week of late nights I relised the layout of what they want is wrong.I am not suprised if you heard my screams their in the USA.
I have made a good start on my new version about a 3rd way through it. But bang I have Hit a brick wall again. Now i feel i can not come back to you guys as you have already been decent to give up your time so far.
Thanks again and I wish all of you on your ranch
the best of luck and good health
Lindsey
17 years ago
Hi again I have took out j and k
ist method works okay ie.
if I enter Liverpool it displays all flights
Then I ask for a flight number ie 553 I
expected it to print out "Frankfurt" as that
flight leaves liverpool to "Frankfurt"
but
what the 2nd method is doing is printing out
all destinations with 553.
Can you give us a tip on this please
Lindsey
17 years ago
Thanks for your advise, as you can guess I am still lost with java , if i take out the j and k which i tried before i posted will i be able to call the data then or am i going down the wrong path. As my first method works great, do i have to do 2 more methods one for calling destination and one for time.
oh am i laying my code out in the right order the way i placing methods and the rest out.
thanks again
Lindsey
17 years ago
Hi every one, yet again
First I must state I must use this type of array
The program works for the first stage ie. when i type a name of a airport in. It displays all the flights.(great that took me 4 nights to work out)
The program then ask for a flight number.
It is supposed to display the destination and flight time.
But it is now I get array out of bounds ???
also in compiling I get this, which i thought i would need to display fight time.

Error message =
\java\AirLine1.java:119: cannot resolve symbol
symbol : variable k
location: class AirLine
System.out.print(" Destination " +info1[ j ] +" Flight Time"+ info1[k]+"\n " );
^
1 error
Process completed.

Can any one tell me where I am going wrong in my code please. I have posted the full code so far but I can't get pass this problem.

Thanks if you can advise a learner to java
Lindsey
17 years ago
Thanks Greg for your advise
I am now trying with a 2d array, got my first part working calling the airport Liverpool it now displays all 3 flights. Used a counter which I read about in a book.I am stuck on second bit, will try and sort it out but I am totally confused. You will see what I mean if I can not sort it . I hope you guys won't object me coming back with a new post.
Thanks again all the little problems seem major when you are just in your 1st stage of learning.
Oh a special thanks to you guys who run this site for beginners, as other site's mock us for asking. What must be silly questions to them.
Wish I could send a thank you card to the ranch for all the Staff and you guys and girls who give up your time to help the likes of myself.
Sorry for going on to much
Take care every one xxxx
Lindsey
17 years ago
Thanks a million
I will log off now and try rewriting my code, it seems what we get told and what you guys do are worlds apart.
thanks again for your help and I hope the weather in your country is warmer than it is here in the UK
good night
lindsey
17 years ago
Sorry I should have pointed out I wanted to print all flights from Liverpool 3 in all
Thanks if you can advise
Lindsey
17 years ago
Hi I have done what I hope is a 3 dimensional array, all I am doing is to get it to print out Liverpool and the 3 flight numbers, but i am confused over the [][][] if i have the right values as it print outs
"rubbish" flights "rubbish"
here is my code so far,
17 years ago
Thank Maulin
It makes sense what you say, but I am only in my 4th week of java with only 2hours a week on it.
We have been told to do this assignment in arrays.
Please don't send me the code as I do not want to cheat.
What I need to know if I am doing the right array or not as we have been told we could ask advise only.
What would be great for me,if one of your ranchers could advise me by e-mail.
I could send my code and problem, they would only have to say your on the right trail, or back up and look at your last piece of code ect
That way with a helping hand from a expert I think I would learn java the best way.
So what the heck ! any one fancy advising a real novice, promise not to bomb-bar you with e-mails
Well thanks agains I have printed your answer for when we use vectors.
Take care you all on the ranch
Lindsey
17 years ago
Hi to every one, sorry I keep coming back but you seem like a good bunch out their.I need to do a 3imensional array.But I am new to programming, with no cow hands here to help me.
As you will see its a array of airports ect but each airport could have upto 5 flights a day. So i need to take that into consideration.From the array if i enter a airport name it should display the flights numbers.
which is the correct way to lay it out,

thanks lindsey
17 years ago