A file PASSENGERS.DAT stores the records of passengers using the following structure:
PNR, PName, BRDSTN, DESTN, FARE
Where:
- PNR — Passenger Number (string type)
- PName — Passenger Name (string type)
- BRDSTN — Boarding Station Name (string type)
- DESTN — Destination Station Name (string type)
- FARE — Fare amount for the journey (float type)
Write user-defined functions in Python for the following tasks:
(i) Create() – to input data for passengers and write it in the binary file PASSENGERS.DAT.
(ii) SearchDestn(D) – to read contents from the file PASSENGERS.DAT and display the details of those Passengers whose DESTN matches with the value of D.
(iii) UpdateFare() – to increase the fare of all passengers by 5% and rewrite the updated records into the file PASSENGERS.DAT.
Comments