Professional Documents
Culture Documents
OOPS Practice Problems
OOPS Practice Problems
Royal Orchid is a florist. They want to be alerted when stock of a flower goes
below a particular level.
The flowers are identified using name, price per kg and stock available (in
kgs).
Write a Python program to implement the above requirement.
"WonderLand" water theme park wants to generate tickets for its customers.
Complete the implementation of the requirement based on the given class
diagram and code.
Class Description:
Theme Park class: Complete the class based on comments given in starter
code
Ticket class: Complete the class based on comments given in starter code
Customer class:
ABC DTH (Direct to Home) firm wants to calculate monthly rent for its
consumers.
A consumer can register for one Base Package. Write a python program to
implement the below given class diagram.
Class Description:
DirectToHomeService class:
BasePackage class:
1. validate_base_pack_name():
a. Validate base pack name. Valid values are "Silver", "Gold" and
"Platinum".
b. If invalid, set attribute, base_pack_name as "Silver" and display
"Base package name is incorrect, set to Silver"
2. calculate_monthly_rent():
a. Check if subscription period is between 1 and 24 (both
inclusive). If so,
● Validate base pack name
● Identify monthly rent based on base pack. Refer table
given.
● Consumers are eligible for discount of one month's rent, if
subscription period is more than 12 months
● Calculate final monthly rent as per the formula given
below:
● final monthly rent = ((monthly rent * subscription period)
– discount amount)/subscription period
● Return the calculated final monthly rent
b. If not, return -1