In a file flights.txt it maintains
a list of flights, in the following form:
flight number; departure city;
arrival city; number of seats;
miles
The fields are separated by semicolons. City names may have blanks
in them (like San Francisco).
The flight number 0 indicates the end of the file. We know tthere
are fewer than 100 flights.
(A flight corresponds to an airplane.)
In a file passengers.txt the airline
maintains a list of passengers for flights in the following format:
flight number; last name; first name;
frequent flier number (0 if there is none)
The flight number 0 indicates the end of the file.
Being in the frequent flier program is optional for a customer, and
a passenger must have signed up to be a frequent flier - this process is
not part of this assignment. For this assignment, if they have a
nonzero frequent flier number then they have signed up, else they are just
ordinary passengers.
In a file birdbrains.txt the airline
maintains a list of those who have signed up as frequent fliers in the
form
frequent flier number
accumulated miles
The frequent flier number of 0 indicates the end of the file.
This file does not contain information for all the passengers, only those
who have signed up to be frequent fliers. (Once a passenger has signed
up to be a frequent flier, and once they have accumulated 20000 miles on
previous flights, they get treated special, receiving complimentary birdseed
on flights.)
Develop a passenger class to store all the information for a passenger and to handle appropriate methods.
Develop an airplane class which contains (at least)
Build an array, fleet, of airplanes.
Using these tools, write a program
that will read the appropriate files, build the fleet of airplanes, put
the passengers on the correct flights(airplanes), and print out the following
files:
flightlist.txt listing each flight with all its passengers in
the following format:
flight number departure
city arrival city number of seats
number of passengers
last name, first name bb
(bb if the customer already has more than 20000 frequent flier miles)
last name, first name ...
***
flight number ...
birdbrains2.txt with the same format as birdbrains.txt, but with the frequent flier miles updated to reflect the miles of the current flight.
This is a batch program that should require no input from the user. However, it should run on any files I provide that are of the right format.
The end of file markers are just a number, not a whole set of flight
info, passenger info, etc. For that reason you may want to try the
function peek:
char istream::peek()
which reads and returns the next character on the istream without removing
it from the istream. Therefore you can peek at the next char, end
if it is the eof number, or read the line as a flight or passenger if it
is not the end of file.
Sample call:
char c = cin.peek();
I have put up sample files. They are not the ones I will use for testing the program, but the ones I use will be of the same form. Things to note: