Implement the design of the Laptop and Store classes so that the following  code generates the output below: print("Total Laptop Created:",Laptop.total_laptop) print("1.=========================================") s1 = Store() p1 = Laptop("Lenovo B4180", 55000) print("2.=========================================") p2 = Laptop("HP Pavilion") print("3.=========================================") s1.add_laptop(p1, p2) print("4.=========================================") p2.setPrice(77000) s1.add_laptop(p2) print("5.=========================================") s1.sell_laptop("HP Probook") print("6.=========================================") print(s1) print("7.=========================================") s2 = Store("Star Tech") p3 = Laptop("HP Probook", 58000) print("8.=========================================") p4 = Laptop("Lenovo Thinkpad", 60000) print("9.=========================================") p5 = Laptop("HP Elite", 80000) print("10.=========================================") s2.add_laptop(p3, p4, p5) print("11.=========================================") print(s2) print("12.=========================================") s2.sell_laptop("HP Probook") print("13.=========================================") print(s2) print("14.=========================================") print("Total Laptop Created:",Laptop.total_laptop)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Implement the design of the Laptop and Store classes so that the following 
code generates the output below:

print("Total Laptop Created:",Laptop.total_laptop)
print("1.=========================================")
s1 = Store()
p1 = Laptop("Lenovo B4180", 55000)
print("2.=========================================")
p2 = Laptop("HP Pavilion")
print("3.=========================================")
s1.add_laptop(p1, p2)
print("4.=========================================")
p2.setPrice(77000)
s1.add_laptop(p2)
print("5.=========================================")
s1.sell_laptop("HP Probook")
print("6.=========================================")
print(s1)
print("7.=========================================")
s2 = Store("Star Tech")
p3 = Laptop("HP Probook", 58000)
print("8.=========================================")
p4 = Laptop("Lenovo Thinkpad", 60000)
print("9.=========================================")
p5 = Laptop("HP Elite", 80000)
print("10.=========================================")
s2.add_laptop(p3, p4, p5)
print("11.=========================================")
print(s2)
print("12.=========================================")
s2.sell_laptop("HP Probook")
print("13.=========================================")
print(s2)
print("14.=========================================")
print("Total Laptop Created:",Laptop.total_laptop)

OUTPUT:
Total Laptop Created: 0
1.=========================================
Laptop created.
Model: Lenovo B4180
Price: 55000
2.=========================================
Laptop created.
Model: HP Pavilion
Price: Not Set
3.=========================================
Lenovo B4180 model has been added to Ryans store.
You can not add HP Pavilion without price
4.=========================================
HP Pavilion model has been added to Ryans store.
5.=========================================
HP Probook is not available at the Ryans store
6.=========================================
Store Name: Ryans
List of available Laptops:
Model Name: Lenovo B4180 --> Price: 55000
Model Name: HP Pavilion --> Price: 77000
Total Laptop in Stock: 2
Total Price of Stocked Laptops: 132000
7.=========================================
Laptop created.
Model: HP Probook
Price: 58000
8.=========================================
Laptop created.
Model: Lenovo Thinkpad
Price: 60000
9.=========================================
Laptop created.
Model: HP Elite
Price: 80000
10.=========================================
HP Probook model has been added to Star Tech store.
Lenovo Thinkpad model has been added to Star Tech store.
HP Elite model has been added to Star Tech store.
11.=========================================
Store Name: Star Tech
List of available Laptops:
Model Name: HP Probook --> Price: 58000
Model Name: Lenovo Thinkpad --> Price: 60000
Model Name: HP Elite --> Price: 80000
Total Laptop in Stock: 3
Total Price of Stocked Laptops: 198000
12.=========================================
HP Probook has been sold at the price 58000
13.=========================================
Store Name: Star Tech
List of available Laptops:
Model Name: Lenovo Thinkpad --> Price: 60000
Model Name: HP Elite --> Price: 80000
Total Laptop in Stock: 2
Total Price of Stocked Laptops: 140000
14.=========================================
Total Laptop Created: 5

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Math class and its different methods
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education