1. Engineering
  2. Computer Science
  3. write a java program called streetbjava that firstly prompts asks...

Question: write a java program called streetbjava that firstly prompts asks...

Question details

Write a Java program called StreetB.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. Also, your program must work with any file name of the correct 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 starting road and a starting cross street. Then the user is prompted to enter an ending road and an ending cross street. The user entry for both starting and ending road's and starting and ending cross street's must be case insensitive. That is, Brunswick Street and BRunswIcK strEET must produce the same result. T

he program then displays to the screen all the details of Tram stops (the complete record) that match between the starting road, starting cross street, and the ending road, ending cross street, as entered by the user. This includes the starting and ending road/cross street stops. To do this, your program will need to read the entire contents of the file, line by line. 

If there is no matching start road/start cross street, as entered by the user, then an appropriate message is displayed to the screen.

If there is no matching ending road/ending cross street, as entered by the user, but there is a matching start road/start cross street, the program displays all the Tram stop records from the starting road/starting cross street to the end of file. Then the program displays an appropriate message to indicate that it could not find the ending road/ending cross street. 

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution