Question: Read this exercise carefully and take your time to work out the logic. Your chapter 1 0 folder contains versions of rome - report.html and
Read this exercise carefully and take your time to work out the logic. Your chapter folder contains versions of romereport.html and romereport.php as well as a text file named travel.dat which contains a list of travel reservations. Each line in the travel.dat file contains a single reservation: the name of a destination, number of people traveling, and number of nights staying, for example:
Rome::
Tokyo::
The program should read the file and report the number of reservations in the file for Rome, and the total number of people traveling to Rome. For testing purposes, the correct number of reservations for Rome is and the correct number of people traveling to Rome is but your code should still work correctly if you change the data in the file Note that the data file is named travel.dat and not travel.txt
Not sure what to do Use your text editor to open travel.dat. Now take a piece of paper and pencil, and solve the problem as if you are the romereport.php program. Each time you read a line from the file and identify the destination, number of people traveling, and number of nights staying, how are
you deciding whether or not to increase the count of Rome reservations, and the total of the number of people traveling to Rome, and what amount are you adding to the count of Rome reservations and the total number of Rome travelers? Now consider how to follow the same procedure in your code. HINT: Review the processwages example in the chapter. Although that code is designed to calculate a average you will see that it uses a similar procedure to the one you will need to develop for this exercise.
travel.dat
Rome::
Tokyo::
Rome::
Santiago::
Cairo::
Cairo::
Barcelona::
Rome::
Santiago::
Cairo::
Rome::
Rome::
Barcelona::
Tokyo::
Cairo::
Rome::
Barcelona::
Tokyo::
Rome::
Cairo::
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
