Question: Define a class called Package, which will have a maximum item capacity of 6 . The package should be initialized with the number of items.
Define a class called Package, which will have a maximum item capacity of
The package should be initialized with the number of items.
If the number of items exceeds the capacity limit during initialization, it should print out a message indicating that the limit has been exceeded and only initialize how many items should be removed from the package.
Otherwise, if the number of items does not exceed the limit it should print out a message that includes how many items are in the package.
Our aim here is to practice creating class attributes.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
