The task requires me to produce an application that first requests a time period from the user then proceeds to read the available journeys from a file, in the following format:
<journey name>
<c> // where c is the number of changes
<dn><sn> // for each leg n, dn is the distance and sn is the speed. Note n=(c+1).
My application will calculate the total journey time for each journey and then compare it with the time period specified by the user. If the journey can be completed in the specified time then the result must be written to the screen and to an output text file called results.txt. If the journey cannot be completed in time then the results must be written to the screen only. Messages to the screen must indicate whether the journey is suitable or not.
This is the text file:
Journey One
1
200 90
100 60
Journey Two
0
300 120
Journey Three
2
50 50
50 75
100 60
I'm having trouble reading the data from the file need to use a while loop but not sure how to go about this any tips?