Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Problem Statement

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.

Details of Flower class are given below:

Class name: Flower


Problem Statement

"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:

1. Initialize points_earned, food_coupon and ticket to 0, "No" and a


Ticket object respectively in the constructor
2. play_game():
a. Calculate total points based on the list of games played by the
customer
b. Update attribute, points_earned with the calculated value
c. ThemePark allows a free ride on Game 2 if the customer has
opted for Game 3. If this is satisfied, add "Game2" to
list_of_games and include its points to total points
3. update_food_coupon(): They provide food coupon to a customer
who has opted Game 4 and has earned more than 15 points.
a. Update attribute, food_coupon status to "Yes" if the above rule is
satisfied
4. book_ticket():
a. Calculate ticket amount
b. If amount can be calculated, generate ticket id, play game,
update food coupon and return true
c. Else, return false

Note: Perform case sensitive string comparison


Problem Statement

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:

1. Initialize static variable counter to 101


2. Inside constructor, auto-generate consumer_number starting from 101

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

You might also like