Write the Python code that defines a class called Vehicle , which will have a maximum occupancy of 8 .
This problem has been solved!
Do you need an answer to a question different from the above? Ask your question!
Question:
Write the Python code that defines a class called Vehicle, which will have a maximum occupancy of 8. The vehicle should be initialized with the number of occupants. If the number of occupants exceeds the limit during initialization, it should print a message indicating that the limit has been exceeded and only initialize how many occupants should step off the vehicle. The first vehicle has 6 occupants and the second vehicle has 10 occupants.
Output:
The first vehicle has 6 occupants.
The maximum occupancy limit has been exceeded. 2 occupants must exit the vehicle.
The second vehicle has 10 occupants.
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
View Solution
Create a free account to access the answer
Cannot find your solution?
Post a FREE question now and get an answer within minutes.
* Average response time.
Posted Date: September 12, 2023 00:42:54