Question: Write a Python program to make and cancel reservations on a single route on a single day. Here are core specifications for the software. 1.
Write a Python program to make and cancel reservations on a single route on a single day.
Here are core specifications for the software.
1. Input. The input will be read from a text file named transactions.csv. Each line will have a single integer. The first number is the beginning number of seats available for the route and must be non-negative.
2. Starting Availability. The availableStart is the first integer from the input.
3. Reservations. The number of reservations is computed as the sum of all positive integers from the input, except the first number of the input is not included.
4. Cancellations. The number of cancellations is computed as the sum of the negative integers from the input, except the first number of the input is not included.
5. Ending Availability. The availableEnd is computed as availableStart minus reservations minus cancellations. Note that subtracting the positive sum of reservations subtracts them from availability and subtracting the negative sum of cancellations adds them back into availability.
6. Output. The output will be one printed line in CSV format: availableStart,reservations,cancellations,availableEnd Note that cancellations should be a negative number.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
