Design the required class(es) so that the following expected output is generated. Do not change any given code. # Write you code here fareChart = {'SR Travels': 40, 'ENA': 50, 'Pathao': 200, 'Uber': 250, 'Hanif Paribahan': 45, 'Others': 90 } v1 = Vehicle("Dhaka-123", "Bus", 'SR Travels', fareChart) p1 = Passenger("Sam", "Dhaka") print("1.===========================") v1.addPassenger(p1) print("2.===========================") p1.calculateFare(v1) print("3.===========================") p2 = Passenger("John", "Dhaka") p3 = Passenger("Bran") print("4.===========================") p3.setDestination("Chittagong") print("5.===========================") v1.addPassenger(p2, p3) print("6.===========================") p2.calculateFare(v1) print("7.===========================") p4 = Passenger("Mark", "Dhaka") p5 = Passenger("Jack", "Khulna") v1.addPassenger(p4, p5) print("8.===========================") p4.calculateFare(v1) print("===========================") v1.status() v2 = Vehicle("Chittagong-798", "Car", "Uber", fareChart) print("9.===========================") v2.addPassenger(p1) v2.addPassenger(p3) print("10.===========================") p3.calculateFare(v2) print("11.===========================") v2.status() v3 = Vehicle("Khulna-997", "Car", "Obhai", fareChart) v3.addPassenger(p5) print("12.===========================") p5.calculateFare(v3) print("13.===========================") v3.status() Output: 1.=========================== Sam has taken the Bus. 2.=========================== Calculating fare for Sam 3.=========================== Destination cannot be empty! 4.=========================== Destination of Bran is updated to Chittagong 5.=========================== John has taken the Bus. This is an Inter-City Bus. Bran cannot take the Bus. 6.=========================== Calculating fare for John 7.=========================== Mark has taken the Bus. This is an Inter-City Bus. Jack cannot take the Bus. 8.=========================== Calculating fare for Mark =========================== Details of Dhaka-123 Bus of SR Travels: Total Passengers: 3 Passenger name : Sam, Destination: Dhaka, Ticket Price: 40 Passenger name : John, Destination: Dhaka, Ticket Price: 40 Passenger name : Mark, Destination: Dhaka, Ticket Price: 40 9.=========================== This is an Inter-City Car. Sam cannot take the Car. Bran has taken the Car. 10.=========================== Calculating fare for Bran 11.=========================== Details of Chittagong-798 Car of Uber: Total Passengers: 1 Passenger name : Bran, Destination: Chittagong, Ticket Price: 250 Jack has taken the Car. 12.=========================== Calculating fare for Jack 13.=========================== Details of Khulna-997 Car of Obhai: Total Passengers: 1 Passenger name : Jack, Destination: Khulna, Ticket Price: 90
Design the required class(es) so that the following expected output is
generated. Do not change any given code.
# Write you code here
fareChart = {'SR Travels': 40, 'ENA': 50, 'Pathao': 200, 'Uber':
250, 'Hanif Paribahan': 45, 'Others': 90 }
v1 = Vehicle("Dhaka-123", "Bus", 'SR Travels', fareChart)
p1 = Passenger("Sam", "Dhaka")
print("1.===========================")
v1.addPassenger(p1)
print("2.===========================")
p1.calculateFare(v1)
print("3.===========================")
p2 = Passenger("John", "Dhaka")
p3 = Passenger("Bran")
print("4.===========================")
p3.setDestination("Chittagong")
print("5.===========================")
v1.addPassenger(p2, p3)
print("6.===========================")
p2.calculateFare(v1)
print("7.===========================")
p4 = Passenger("Mark", "Dhaka")
p5 = Passenger("Jack", "Khulna")
v1.addPassenger(p4, p5)
print("8.===========================")
p4.calculateFare(v1)
print("===========================")
v1.status()
v2 = Vehicle("Chittagong-798", "Car", "Uber", fareChart)
print("9.===========================")
v2.addPassenger(p1)
v2.addPassenger(p3)
print("10.===========================")
p3.calculateFare(v2)
print("11.===========================")
v2.status()
v3 = Vehicle("Khulna-997", "Car", "Obhai", fareChart)
v3.addPassenger(p5)
print("12.===========================")
p5.calculateFare(v3)
print("13.===========================")
v3.status()
Output:
1.===========================
Sam has taken the Bus.
2.===========================
Calculating fare for Sam
3.===========================
Destination cannot be empty!
4.===========================
Destination of Bran is updated to Chittagong
5.===========================
John has taken the Bus.
This is an Inter-City Bus. Bran cannot take the Bus.
6.===========================
Calculating fare for John
7.===========================
Mark has taken the Bus.
This is an Inter-City Bus. Jack cannot take the Bus.
8.===========================
Calculating fare for Mark
===========================
Details of Dhaka-123 Bus of SR Travels:
Total Passengers: 3
Passenger name : Sam, Destination: Dhaka, Ticket Price: 40
Passenger name : John, Destination: Dhaka, Ticket Price: 40
Passenger name : Mark, Destination: Dhaka, Ticket Price: 40
9.===========================
This is an Inter-City Car. Sam cannot take the Car.
Bran has taken the Car.
10.===========================
Calculating fare for Bran
11.===========================
Details of Chittagong-798 Car of Uber:
Total Passengers: 1
Passenger name : Bran, Destination: Chittagong, Ticket Price: 250
Jack has taken the Car.
12.===========================
Calculating fare for Jack
13.===========================
Details of Khulna-997 Car of Obhai:
Total Passengers: 1
Passenger name : Jack, Destination: Khulna, Ticket Price: 90
Step by step
Solved in 3 steps with 4 images