self.baseFare = fare def __str__(self): s = “Name: ”+self.name+", Base fare: "+str(self.baseFare) return s # Write your codes here. # Do not change the following lines of code. t1 = Bus(“Volvo”, 950) print("=================================") t1.addPassengerWithBags(“David”, 6, “Mike”, 1, “Carol”, 3) print("=================================") print(t1) print("=================================")

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

write python coiide within 30 minutes
Design Bus class and Train class which inherit Transport class so that the
following code provides the expected output. [addPassengerWithBags() method
should work any number of parameters assuming that the parameter number
will be an even number and greater than 1]

Note: A passenger can carry upto 2 bags for free. 60 taka will be added if
the number of bags is between 3 and 5. 105 taka will be added if the number
of bags is greater than 5.

class Transport:
total_traveller = 0

def __init__(self, name, fare):
self.name = name
self.baseFare = fare

def __str__(self):
s = “Name: ”+self.name+", Base fare: "+str(self.baseFare)
return s

# Write your codes here.
# Do not change the following lines of code.
t1 = Bus(“Volvo”, 950)
print("=================================")
t1.addPassengerWithBags(“David”, 6, “Mike”, 1, “Carol”, 3)
print("=================================")
print(t1)
print("=================================")
t2 = Train(“Silk City”, 850)
print("=================================")
t2.addPassengerWithBags(“Bob”, 2, “Simon”, 4)
print("=================================")
print(t2)
print("=================================")
print(“Total Passengers in Transport: ”, Transport.total_traveller )

OUTPUT:
Base-fare of Volvo is 950 Taka
===============================
===============================
Name: Volvo, Base fare: 950
Total Passenger(s): 3
Passenger details:
Name: David, Fare: 1055
Name: Mike, Fare: 950
Name: Carol, Fare: 1010
===============================
Base-fare of Silk City is 850 Taka
===============================
===============================
Name: Silk City, Base fare: 850
Total Passenger(s): 2
Passenger details:
Name: Bob, Fare: 850
Name: Simon, Fare: 910
===============================
Total Passengers in Transport: 5

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Developing computer interface
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education