Write MacBookPro2020 class and iPhone12 class which inherit AppleProduct class so that the following code provides the
Question:
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
Small Business Management Entrepreneurship and Beyond
ISBN: 978-0538453141
5th edition
Authors: Timothy s. Hatten