Write the Python code that defines a class called Vehicle , which will have a maximum occupancy
Fantastic news! We've Found the answer you've been seeking!
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
Posted Date: