Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exam Data Submit Help Question 22 Object Oriented Programming: Write your solution in the OOP solution.py file in the OOP package Pizza4u is a popular

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Exam Data Submit Help Question 22 Object Oriented Programming: Write your solution in the OOP solution.py file in the OOP package Pizza4u is a popular Pizza delivery outlet in US. They want to automate their bill calculation system. Implement the class diagram below to achieve the same. Class Diagram: Customer - cust name - address _init_cust_name, address) + get_cust_namel) + get_address() + validate_cust_details Pizzaservice - token_id - pizza size - customer - offer_code - pizza_details static - counter static _init_(pizza_size, offer_code, customer) +get_token_ido set_token_id token_id) + get_pizza_size() + get_customer +get_offer_code() + get_counter_value() static + identify_discount_amt + calculate bill amount(pizza_count) Pizza Delivery Service - distance - bill amount ut pose wi PlezaDelivery Service - distance - bill_amount Init_(pizza_size, offer_code, customer, distance) + get_bill_amount() + set bill_amount(bill amount) + calculate bill amount(pizza_count) Note: Do not include any extra instance/static variables and instance/static methods in the given dasses Case sensitive comparison is required to be done wherever applicable Do not change any value or case of the given variables Read notes and examples for better understanding of the logic Implementation Details: Class Name Customer PizzaService Pizza Delivery Service Implementation Details Partially implemented Partially implemented Partially implemented Customer class validate cust detailsel: Exam Data Submit Help Customer class validate_cust_details(): This method validates the customer details like cust_name and address. Returns true if both are valid. Otherwise return false The cust_name and address would be valid only when o they are not None and o they are not empty strings Pizzaservice class pizza_details: This is a static list that has para costs (integer). The indices of the list would represent the pizzo stele. 0. 1 and 2 represents emular', 'Medium' and 'Lange size pizzas The initial value of the list is given below - pizza_details (20,40, 60] For Examples of the pizza sire o, the unit cost of pure would be $20 and if pizza size is 2 the unit cost of pure would be $60 Note: No Need to initialize this list. It is supplied identify_discount_amt(): This method identifies the discount amount based on offer_code if offer_code is exactly three characters and its last two characters are digits, extract and return last two digits in integer formas discount amount Otherwise, return as discount amount Example 1: if offer code is 'CAO' then discount amount is $40 Example 2: tf offer code is 'C-4' then discount amount is 0 calculate bill_amount pura_count): Example 2: If offer code is 'C-4' then discount amount iso calculate bill amount(pero count): This method accepts ple_count (integer) as parameter, calculates and returns total pizza cost If either pinza count is negative value or zero, or pizza size is not in between 0 and 2 (boundary values are included), set token idto 1. Return total pla costas-1 Otherwise, Invoke get_counter_value() method to receive latest value of counter, Set the received value to token id Identify the unit cost of pizza from pizza details list for the corresponding pizza size For Examples of the pizza size is 1, the unit cost of pizza would be $10 and if punaste is 2 the unit cost of pure would be $60 calculate the total pizza_cost as the product of unit cost of pizza and pizzo_count o Return total perro cost Example 1: if pizza count is 3 and pizza size is 1 then total pezza cost is $120 and token id would be 1001 Example 2: if p _count is O and pizza_size is 1 then total para cost and token id would be -1 Example 3: if pizza_count is 3 and pizza size is 3 then total pizzo cost and token id would be -1 PizzaDelivery Service class calculate_bill amount pizzo_count): This is an overridden method, which accepts pizza_count (integer) as parameter, calculates and sets bill amount instance variable Invoke calculate bill amount() method of parent class by passing the puze_count as parameter to get total pure cost Invoke validate_cust_details() method of Customer class if validate_cust_details() method returns false or total pura_cost is 1 or distance is a negative value, set bill_amount and token_id instance variables to-1 Otherwise, 95 Example 1: if pro count is 3 and pizza size is 1 then total pizzo cost is $120 and token ld would be 1001 Example 2: if pizza count is and pizza size is 1 then total pizzo cost and token id would be -1 Example 3: if pizo count is 3 and pizza size is 3 then total pizza cost and token id would be -1 PizzaDelivery Service class calculate_bill_amount (pizzo_count): This is an overridden method, which accepts pizzo_count integer) as parameter, calculates and sets bill amount instance variable Invoke calculate_bill amount() method of parent class by passing the pizze_count as parameter to get total pue_cost Invoke validate_cust_details() method of Customer class if validate cust details() method returns false or total pizza costis-1 or distance is a negative value, set bill amount and token Id instance variables to-1 Otherwise, Calculate travel charges for given distance as $0.25 (25 cents) per mile. Calculate total cost as the sum of total pizzo_cost and travel charges o Invoke identify discount amt() method to get the discount amount o f discount amount is greater than or equal to total cost, set bill amount and token id instance variablesto-1 Otherwise, calculate and set bill amount by subtracting discount amount from total cost Example 1: if cust_name is 'George', address is 'Sherlin Street', plaza_size is 1, offer code is '60', distance is 30 Miles and pizza_count is 3 then bill amount is $67.50 Example 2: if cust_name is 'George', address is 'Sherlin Street', pizza_sire is -1, offer_code is '0', distance is 30 Miles and pizzo_count is the bill amount is -1 All the Best 2 Etos De Exam Data Submit Help Question 22 Object Oriented Programming: Write your solution in the OOP solution.py file in the OOP package Pizza4u is a popular Pizza delivery outlet in US. They want to automate their bill calculation system. Implement the class diagram below to achieve the same. Class Diagram: Customer - cust name - address _init_cust_name, address) + get_cust_namel) + get_address() + validate_cust_details Pizzaservice - token_id - pizza size - customer - offer_code - pizza_details static - counter static _init_(pizza_size, offer_code, customer) +get_token_ido set_token_id token_id) + get_pizza_size() + get_customer +get_offer_code() + get_counter_value() static + identify_discount_amt + calculate bill amount(pizza_count) Pizza Delivery Service - distance - bill amount ut pose wi PlezaDelivery Service - distance - bill_amount Init_(pizza_size, offer_code, customer, distance) + get_bill_amount() + set bill_amount(bill amount) + calculate bill amount(pizza_count) Note: Do not include any extra instance/static variables and instance/static methods in the given dasses Case sensitive comparison is required to be done wherever applicable Do not change any value or case of the given variables Read notes and examples for better understanding of the logic Implementation Details: Class Name Customer PizzaService Pizza Delivery Service Implementation Details Partially implemented Partially implemented Partially implemented Customer class validate cust detailsel: Exam Data Submit Help Customer class validate_cust_details(): This method validates the customer details like cust_name and address. Returns true if both are valid. Otherwise return false The cust_name and address would be valid only when o they are not None and o they are not empty strings Pizzaservice class pizza_details: This is a static list that has para costs (integer). The indices of the list would represent the pizzo stele. 0. 1 and 2 represents emular', 'Medium' and 'Lange size pizzas The initial value of the list is given below - pizza_details (20,40, 60] For Examples of the pizza sire o, the unit cost of pure would be $20 and if pizza size is 2 the unit cost of pure would be $60 Note: No Need to initialize this list. It is supplied identify_discount_amt(): This method identifies the discount amount based on offer_code if offer_code is exactly three characters and its last two characters are digits, extract and return last two digits in integer formas discount amount Otherwise, return as discount amount Example 1: if offer code is 'CAO' then discount amount is $40 Example 2: tf offer code is 'C-4' then discount amount is 0 calculate bill_amount pura_count): Example 2: If offer code is 'C-4' then discount amount iso calculate bill amount(pero count): This method accepts ple_count (integer) as parameter, calculates and returns total pizza cost If either pinza count is negative value or zero, or pizza size is not in between 0 and 2 (boundary values are included), set token idto 1. Return total pla costas-1 Otherwise, Invoke get_counter_value() method to receive latest value of counter, Set the received value to token id Identify the unit cost of pizza from pizza details list for the corresponding pizza size For Examples of the pizza size is 1, the unit cost of pizza would be $10 and if punaste is 2 the unit cost of pure would be $60 calculate the total pizza_cost as the product of unit cost of pizza and pizzo_count o Return total perro cost Example 1: if pizza count is 3 and pizza size is 1 then total pezza cost is $120 and token id would be 1001 Example 2: if p _count is O and pizza_size is 1 then total para cost and token id would be -1 Example 3: if pizza_count is 3 and pizza size is 3 then total pizzo cost and token id would be -1 PizzaDelivery Service class calculate_bill amount pizzo_count): This is an overridden method, which accepts pizza_count (integer) as parameter, calculates and sets bill amount instance variable Invoke calculate bill amount() method of parent class by passing the puze_count as parameter to get total pure cost Invoke validate_cust_details() method of Customer class if validate_cust_details() method returns false or total pura_cost is 1 or distance is a negative value, set bill_amount and token_id instance variables to-1 Otherwise, 95 Example 1: if pro count is 3 and pizza size is 1 then total pizzo cost is $120 and token ld would be 1001 Example 2: if pizza count is and pizza size is 1 then total pizzo cost and token id would be -1 Example 3: if pizo count is 3 and pizza size is 3 then total pizza cost and token id would be -1 PizzaDelivery Service class calculate_bill_amount (pizzo_count): This is an overridden method, which accepts pizzo_count integer) as parameter, calculates and sets bill amount instance variable Invoke calculate_bill amount() method of parent class by passing the pizze_count as parameter to get total pue_cost Invoke validate_cust_details() method of Customer class if validate cust details() method returns false or total pizza costis-1 or distance is a negative value, set bill amount and token Id instance variables to-1 Otherwise, Calculate travel charges for given distance as $0.25 (25 cents) per mile. Calculate total cost as the sum of total pizzo_cost and travel charges o Invoke identify discount amt() method to get the discount amount o f discount amount is greater than or equal to total cost, set bill amount and token id instance variablesto-1 Otherwise, calculate and set bill amount by subtracting discount amount from total cost Example 1: if cust_name is 'George', address is 'Sherlin Street', plaza_size is 1, offer code is '60', distance is 30 Miles and pizza_count is 3 then bill amount is $67.50 Example 2: if cust_name is 'George', address is 'Sherlin Street', pizza_sire is -1, offer_code is '0', distance is 30 Miles and pizzo_count is the bill amount is -1 All the Best 2 Etos De

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Python Programming MySQL MongoDB OOP And Tkinter

Authors: R. PANNEERSELVAM

1st Edition

9357011331, 978-9357011334

More Books

Students also viewed these Databases questions