I want to have input like:- The first line of the input contains the two cities for where the listing of flight options must be produced â the departure city and the arrival city, separated by a white-space.
The next N lines will contain the available flights and their costs. Each line is a direct flight starting with the departure city name, followed by the arrival city name, and lastly followed by the cost of that flight â all three separate by a white-space character.
Can anyone plz help I want to know how to end the input. I am using:-
Scanner s = new Scanner(System.in); while(!(input = s.nextLine()).equals(" "))
but all in vain.
The data is in the form of
CityA CityB // Upto its I have done. The next N lines i.e. second paragraph is a confusion
Next N lines should be in form
CityA CityC 5000 CityA CityD 3000