Question: Write a Java program called Flying.java that, firstly, prompts (asks) the user to enter an input file name. This is the name of a text

Write a Java program called Flying.java that, firstly, prompts (asks) the user to enter an input file name. This is the name of a text file that can contain any number of records. A record in this file is a single line of text in the following format: Num of passengers^range^name^manufacturer^model.

An example of some of the lines of this file might be: 1^835^Butcher Bird^Focke-Wulf^Fw 190 853^15700^^Airbus^A380-800 10^3200^Flying Fortress^Boeing^B17-G.

Once this file has been opened, the user is then prompted (asked) for a manufacturer and a model. The program then reads through the file. If a matching manufacturer and model is found in the file, all the information for that plane is displayed to the screen. The order of display is shown in the example runs below. Manufacturer's can be repeated in the file, but, the combination of manufacturer AND model is unique in the file, so there will be at most only one match. User entered manufacturer's and model's must be case insensitive, that is, any combination of uppercase and lowercase letters must give the same result. If the entire contents of the file has been read and no match is found, then an appropriate message is displayed to the screen. The data is surrounded by " ". Output is on one line, even though it is shown wrapped around, just to fit on this page.

> java Flying

Enter file name >> planes.dat

Enter manufacturer >> Sukhoi Enter model >> Su-27 Name: "Flanker" model: "Su-27" manufacturer: "Sukhoi" range: "3530kms" passengers: "1"

An example input file for all Tasks may be copied from the csilib area

cp /home/student/csilib/cse1oof/assignA/a.dat .

cp /home/student/csilib/cse1oof/assignA/f.dat .

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!