filmov
tv
Aggregation & InheritanceLevel3|Assignment Set-5|Object Oriented Programming Using Python|NM|Infosys

Показать описание
#naanmudhalvan #infosys #springboard
#answers
#objectorientedprogrammingusingpython
#answersdotcom
#aggregation&inheritancelevel3
Problem Statement
PizzaForYou is a pizza store which sells different kinds of pizzas based on customer's order.
Customer can either collect the order in person or opt for a door delivery.
Write a python program based on the class diagram given below.
Customer class:
validate_quantity(): A customer can order 1 to 5 pizzas
If quantity is valid, return true. Else return false
Pizzaservice class:
Initialize static variable counter to 100
Attribute, additional_topping is a boolean value which indicates whether additional topping is required or not.True – additional topping is required, False – additional topping is not required
validate_pizza_type(): Customers can order "small" or "medium" type pizzas
If pizza type is valid, return true. Else return false
calculate_pizza_cost(): Calculate pizza cost
Validate pizza type and quantity
If valid,
Identify pizza cost based on details mentioned in the table
Set attribute, pizza_cost with the calculated pizza cost
Auto-generate service_id starting from 101 prefixed by first letter of pizza type. Example – S101, s102, m103, S104, M105 etc
If invalid, set pizza_cost to -1
PizzaType
Cost/Pizza(in Rs)
Additional topping cost/Pizza (in Rs), if applicable
Small
150
35
Medium
200
50
Doordelivery class:
validate_distance_in_kms(): Minimum distance for door delivery is 1km and maximum is 10kms
Validate distance_in_kms
If valid, return true. Else, return false
calculate_pizza_cost: Calculate pizza cost
Validate distance in kms
If valid,
Calculate pizza cost (Hint: Invoke overridden method in parent class)
If pizza_cost is not -1, identify delivery charge based on details mentioned below and add it to attribute, pizza_cost
Distance in kms
Delivery Charge in km(in Rs)
For first 5 kms
5
For remaining 5 kms
7
Else, set pizza_cost to -1
Note: Perform case insensitive string comparison
For testing :
Create objects of Pizzaservice and Doordelivery classes
Invoke calculate_pizza_cost() on Pizzaservice and Doordelivery objects
Display the details
#answers
#objectorientedprogrammingusingpython
#answersdotcom
#aggregation&inheritancelevel3
Problem Statement
PizzaForYou is a pizza store which sells different kinds of pizzas based on customer's order.
Customer can either collect the order in person or opt for a door delivery.
Write a python program based on the class diagram given below.
Customer class:
validate_quantity(): A customer can order 1 to 5 pizzas
If quantity is valid, return true. Else return false
Pizzaservice class:
Initialize static variable counter to 100
Attribute, additional_topping is a boolean value which indicates whether additional topping is required or not.True – additional topping is required, False – additional topping is not required
validate_pizza_type(): Customers can order "small" or "medium" type pizzas
If pizza type is valid, return true. Else return false
calculate_pizza_cost(): Calculate pizza cost
Validate pizza type and quantity
If valid,
Identify pizza cost based on details mentioned in the table
Set attribute, pizza_cost with the calculated pizza cost
Auto-generate service_id starting from 101 prefixed by first letter of pizza type. Example – S101, s102, m103, S104, M105 etc
If invalid, set pizza_cost to -1
PizzaType
Cost/Pizza(in Rs)
Additional topping cost/Pizza (in Rs), if applicable
Small
150
35
Medium
200
50
Doordelivery class:
validate_distance_in_kms(): Minimum distance for door delivery is 1km and maximum is 10kms
Validate distance_in_kms
If valid, return true. Else, return false
calculate_pizza_cost: Calculate pizza cost
Validate distance in kms
If valid,
Calculate pizza cost (Hint: Invoke overridden method in parent class)
If pizza_cost is not -1, identify delivery charge based on details mentioned below and add it to attribute, pizza_cost
Distance in kms
Delivery Charge in km(in Rs)
For first 5 kms
5
For remaining 5 kms
7
Else, set pizza_cost to -1
Note: Perform case insensitive string comparison
For testing :
Create objects of Pizzaservice and Doordelivery classes
Invoke calculate_pizza_cost() on Pizzaservice and Doordelivery objects
Display the details
Комментарии