-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathcar_truck_suv_demo.py
53 lines (43 loc) · 1.6 KB
/
car_truck_suv_demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# This program creates a Car object, a Truck object,
# and an SUV object.
import vehicles
def main():
# Create a Car object for a used 2001 BMW
# with 70,000 miles, priced at $15,000, with
# 4 doors.
car = vehicles.Car('BMW', 2001, 70000, 15000.0, 4)
# Create a Truck object for a used 2002
# Toyota pickup with 40,000 miles, priced
# at $12,000, with 4-wheel drive.
truck = vehicles.Truck('Toyota', 2002, 40000, 12000.0, '4WD')
# Create an SUV object for a used 2000
# Volvo with 30,000 miles, priced
# at $18,500, with 5 passenger capacity.
suv = vehicles.SUV('Volvo', 2000, 30000, 18500.0, 5)
print('USED CAR INVENTORY')
print('===================')
# Display the car's data.
print('The following car is in inventory:')
print('Make:', car.get_make())
print('Model:', car.get_model())
print('Mileage:', car.get_mileage())
print('Price:', car.get_price())
print('Number of doors:', car.get_doors())
print()
# Display the truck's data.
print('The following pickup truck is in inventory.')
print('Make:', truck.get_make())
print('Model:', truck.get_model())
print('Mileage:', truck.get_mileage())
print('Price:', truck.get_price())
print('Drive type:', truck.get_drive_type())
print()
# Display the SUV's data.
print('The following SUV is in inventory.')
print('Make:', suv.get_make())
print('Model:', suv.get_model())
print('Mileage:', suv.get_mileage())
print('Price:', suv.get_price())
print('Passenger Capacity:', suv.get_pass_cap())
# Call the main function.
main()