Project-3-Object-oriented-programs
Project-3-Object-oriented-programs
Project 3: Object-oriented
programs
Date Nov 12, 2020
Type Project
General Instructions
Problem A Flights 50 pts)
Problem B Flights, extended 50 pts)
General Instructions
This exercise consists of multiple short problems. Create one Jupyter
Notebook file for the entire exercise.
Save each solution to a problem in a single code cell. Each code cell
should have the name of the problem commented at the very top of the
cell.
The flight must also count the number of regular, discount, and
premium seats sold.
__init__(self) :
If there aren't enough seats, the method ends and prints "Total cost is
0.0".
If there are enough seats available, the method computes the cost,
decreases the number of seats available and updates the counts of the
different seat types.
flyPlane(self) :
changeSeatPrice(self, newCost) :
changeFlightCost(self, newCost) :
The method updates the cost per flight to the value indicated in the
parameter.
printReport(self)
The method prints the total sales, the number of regular, discount and
premium seats sold and the total cost of all the flights.
A customer attempts to buy 50 regular seats, 100 discount seats and 100
premium seats. Print the total bill followed by the report.
A customer attempts to buy 150 regular seats, 0 discount seats and 10
premium seats. Print the total bill.
A customer attempts to buy 180 regular seats, 65 discount seats and 0
premium seats. Print the total bill followed by the report.
[OUT]:
Total cost is 193000.0
----Sales Report-----
Total sales 193000.0
Total regular seats sold 30
Total discount seats sold 25
Total premium seats sold 40
Total flight cost 0.0
---------------------
Total cost is 500000.0
----Sales Report-----
Total sales 693000.0
Total regular seats sold 80
Total discount seats sold 125
Total premium seats sold 140
Total flight cost 30000.0
---------------------
Total cost is 0.0
----Sales Report-----
Total sales 693000.0
Total regular seats sold 80
Total discount seats sold 125
Total premium seats sold 140
Total flight cost 60000.0
---------------------
Total cost is 390000.0
----Sales Report-----
Total sales 1083000.0
Total regular seats sold 125
Total discount seats sold 195
Total premium seats sold 160
Total flight cost 60000.0
---------------------
Total cost is 483000.0
Total cost is 715500.0
----Sales Report-----
Total sales 2281500.0
Total regular seats sold 455
Total discount seats sold 260
Total premium seats sold 170
__init__(self) :
The constructor initializes the values of the new fields that track the
most recent seats bought and the refund rate.
If there aren't enough seats, the method ends and prints "Total cost is
0.0".
If there are enough seats available, the method tracks the latest
number of seats bought
cancelSeats(self) :
The latest seats are deducted from the running totals of bought seats
The cost of the latest seats bought is deducted from the total sales at
the refund rate (e.g. if the refund rate is 50%, a cancelled 10000-worth
of seats is refunded only 5000.
changeRefundRate(self, newRate) :
[OUT]:
Total cost is 380000.0
----Sales Report-----
Total sales 380000.0
Total regular seats sold 30
Total discount seats sold 80
Total premium seats sold 80
Total flight cost 0.0