Question: Code in Python in a simple approach Write the Smartphone class with the required methods to give the following outputs as shown. # Write your
Code in Python in a simple approach
Write the Smartphone class with the required methods to give the following outputs as shown.
| # Write your codes here.
# Do not change the following lines of code. s1 = Smartphone() print("=================================") s1.addFeature(Display, 6.1 inch) print("=================================") s1.setName(Samsung Note 20) s1.addFeature(Display, 6.1 inch) s1.printDetail() print("=================================") s2 = Smartphone(Iphone 12 Pro) s2.addFeature(Display, 6.2 inch) s2.addFeature(Ram, 6 GB) print(=================================") s2.printDetail() s2.addFeature(Display, Amoled panel) s2.addFeature(Ram, DDR5) print("=================================") s2.printDetail() print("=================================") | OUTPUT: ================================= Feature can not be added without phone name ================================= Phone Name: Samsung Note 20 Display: 6.1 inch ================================= ================================= Phone Name: Iphone 12 Pro Display: 6.2 inch Ram: 6 GB ================================= Phone Name: Iphone 12 Pro Display: 6.2 inch, Amoled panel Ram: 6 GB, DDR5 ================================= |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
