Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write MacBookPro2020 class and iPhone12 class which inherit AppleProduct class so that the following code provides the expected output. You need to overwrite necessary methods

Write MacBookPro2020 class and iPhone12 class which inherit AppleProduct class so that the following code provides the expected output. You need to overwrite necessary methods along with operator overloading. Hint: ● Base price for MacBookPro2020 is 1299 ● Base price of iPhone12 is 799 ● Total tax = (base price * rate of tax) / 100 ● Total price = base price + total tax You are not allowed to change any given code. class AppleProduct: def __init__(self, name, model, base_price): self.name = name self.model = model self.base_price = base_price def companyInfo(self): st = ("Company Name: Apple\nFouder: Steve Jobs, Steve Wozniak, Ronald Wayne\nCurrent CEO: Tim Cook\nAddress: Apple Inc, 2511 Laguna Blvd, Elk Grove, CA 95758, United States") return st def feature(self): st = (f"Name: {self.name}\nProduct Model: {self.model}\nHardware Quality: Excellent Hardwares\nGuarantee/ Warranty: Apple Care") return st def __str__(self): print('This is apple product.') def calculatePrice(self): print('Total Price:', self.base_price) # Write your code here Total Number of Students: 4 Total University Revenue: 429100 m1 = MacBookPro2020('MacBook', 'MacBookPro2020', 8, 'M1', 10) print(m1) print('====================================') m1.calculatePrice() print('###################################') iphone = iPhone12('iPhone', 'iPhone 12', 8, 'A14', 5) print(iphone) print('====================================') iphone.calculatePrice() print('###################################') print('Total Price of these two products: ',end='') print('%.2f Dollars'%(m1 + iphone)) Expected Output: Product Details: Name: MacBook Product Model: MacBookPro2020 Hardware Quality: Excellent Hardwares Guarantee/ Warranty: Apple Care RAM: 8GB Chip: M1 Company Details: Company Name: Apple Fouder: Steve Jobs, Steve Wozniak, Ronald Wayne Current CEO: Tim Cook Address: Apple Inc, 2511 Laguna Blvd, Elk Grove, CA 95758, United States ==================================== Calculating Total Price: Base Price: 1299 Tax: 10% Total Price: 1428.9 ################################### Product Details: Name: iPhone Product Model: iPhone 12 Hardware Quality: Excellent Hardwares Guarantee/ Warranty: Apple Care RAM: 8GB Chip: A14 Company Details: Company Name: Apple Fouder: Steve Jobs, Steve Wozniak, Ronald Wayne Current CEO: Tim Cook Address: Apple Inc, 2511 Laguna Blvd, Elk Grove, CA 95758, United States ==================================== Calculating Total Price: Base Price: 799 Tax: 5% Total Price: 838.95 ################################### Total Price of these two products: 2267.85 Dollars

Step by Step Solution

3.53 Rating (153 Votes )

There are 3 Steps involved in it

Step: 1

This is the base class to organize the all functions and methods class Product def initself name mod... 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

Small Business Management Entrepreneurship and Beyond

Authors: Timothy s. Hatten

5th edition

538453141, 978-0538453141

More Books

Students also viewed these Programming questions