Question: Write a Java program called Maker.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 Maker.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 (lines).
The input file may have 0 to any number of records. The format of the input file is guaranteed to be correct. Your program does not have to check the format.
Once this file has been opened, the program checks if this file is empty (you may assume that the user always enters a valid file name). If the file is empty the program displays an appropriate message to the screen and closes, without using System.exit( ).
If the file is not empty, then the user is prompted (asked) to enter a manufacturer.
The program then displays to the screen all the details of Planes (the complete record) of those Planes made by that manufacturer. This time you have to read the entire file as there may be more than Plane in the file made by this manufacturer.
User input is case insensitive, that is Boeing and bOEing should produce the same result.
If the entire file has been searched and not one match has been found, then an appropriate message is displayed to the screen.
Some sample runs of the program are included below (user input is in bold): (Note that the sample runs do not necessarily show all the functionality required)
> java Maker
Enter file name >> planes.dat Enter manufacturer name >> Boeing Manufacturer: "Boeing" Model: "B17-G" Name: "Flying Fortress" Passengers: "10" Range: "3200 kms" Manufacturer: "Boeing" Model: "747-400" Name: "Jumbo jet" Passengers: "650" Range: "14200 kms"
> java Maker
Enter file name >> planes.dat Enter manufacturer name >> focke-wulf Manufacturer: "Focke-Wulf" Model: "Fw 190" Name: "Butcher Bird" Passengers: "1" Range: "835 kms"
> java Maker
Enter file name >> planes.dat Enter manufacturer name >> OOF ness No Planes made by the manufacturer "OOF ness" were found
> java Maker
Enter file name >> e.dat The file "e.dat" is an empty file Program closing
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
