Task 3 Implement the design of the Passenger class so that the following output is produced: The assumption is Bus base-fare is 450 taka. A passenger can carry upto 20 kg for free. 50 taka will be added if bag weight is between 21 and 50 kg. 100 taka will be added if bag weight is greater than 50 kg. [You are not allowed to change the code below] # Write your code here |Output: Total Passenger: 0 print("Total Passenger:", Passenger.count) p1 = Passenger("Jack") p1.set_bag_weight(90) p2 = Passenger("Carol") Name: Jack Bus Fare: 550 taka Name: Carol Bus Fare: 450 taka p2.set_bag_weight(10) p3 = Passenger("Mike") ===== %3! Name: Mike p3.set_bag_weight(25) Bus Fare: 500 taka == print("=== =") Total Passenger: 3 p1.printDetail() print("= p2.printDetail() print("==== =") p3.printDetail() print("=== print("Total Passenger:", Passenger.count) ======")

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question

python program

Task 3
Implement the design of the Passenger class so that the following output is produced:
The assumption is Bus base-fare is 450 taka. A passenger can carry upto 20 kg for free.
50 taka will be added if bag weight is between 21 and 50 kg. 100 taka will be added if
bag weight is greater than 50 kg.
[You are not allowed to change the code below]
# Write your code here
Output:
Total Passenger: 0
print("Total Passenger:", Passenger.count)
p1 = Passenger("Jack")
Name: Jack
Bus Fare: 550 taka
p1.set_bag_weight(90)
p2 = Passenger("Carol")
Name: Carol
%3D
Bus Fare: 450 taka
p2.set_bag_weight(10)
p3 = Passenger("Mike")
Name: Mike
p3.set_bag_weight(25)
Bus Fare: 500 taka
print("==
=")
Total Passenger: 3
p1.printDetail()
print("=
=")
p2.printDetail()
print("=
=")
p3.printDetail()
print("==
print("Total Passenger:", Passenger.count)
========")
ii
Transcribed Image Text:Task 3 Implement the design of the Passenger class so that the following output is produced: The assumption is Bus base-fare is 450 taka. A passenger can carry upto 20 kg for free. 50 taka will be added if bag weight is between 21 and 50 kg. 100 taka will be added if bag weight is greater than 50 kg. [You are not allowed to change the code below] # Write your code here Output: Total Passenger: 0 print("Total Passenger:", Passenger.count) p1 = Passenger("Jack") Name: Jack Bus Fare: 550 taka p1.set_bag_weight(90) p2 = Passenger("Carol") Name: Carol %3D Bus Fare: 450 taka p2.set_bag_weight(10) p3 = Passenger("Mike") Name: Mike p3.set_bag_weight(25) Bus Fare: 500 taka print("== =") Total Passenger: 3 p1.printDetail() print("= =") p2.printDetail() print("= =") p3.printDetail() print("== print("Total Passenger:", Passenger.count) ========") ii
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT