Refer to the following code and answer the questions on the right: 1 class Product: store_name = "ProtoTop" 1. What will be the output if the following lines of code are executed after the last line? _init_(self, name, category, price, stock, weight_in_grams): self.name = name 4. def hopia.sell(100) print(hopia.stock) self.description - "" self.category - category self.price = price self.stock - stock self.weight_in_grams = weight_in_grams O O O 100 O Not enough stocks of Hopia for selling. 10 100 O Not enough stocks of Hopia for selling. 11 12 def change_name(self, new_name): O An error will occur 13 self.name = new_name
Refer to the following code and answer the questions on the right: 1 class Product: store_name = "ProtoTop" 1. What will be the output if the following lines of code are executed after the last line? _init_(self, name, category, price, stock, weight_in_grams): self.name = name 4. def hopia.sell(100) print(hopia.stock) self.description - "" self.category - category self.price = price self.stock - stock self.weight_in_grams = weight_in_grams O O O 100 O Not enough stocks of Hopia for selling. 10 100 O Not enough stocks of Hopia for selling. 11 12 def change_name(self, new_name): O An error will occur 13 self.name = new_name
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
Related questions
Question
100%
Using PYTHON, help answer the questions on the right:

Transcribed Image Text:Refer to the following code and answer the questions on the right:
1 class Product:
2
store_name = "ProtoTop"
1. What will be the output if the following lines of code are
executed after the last line?
3
4
def _init_(self, name, category, price, stock, weight_in_grams):
self.name = name
hopia.sell(100)
print(hopia.stock)
self.description =
self.category = category
8
self.price = price
O 100
self.stock = stock
O Not enough stocks of Hopia for selling.
100
10
self.weight_in_grams = weight_in_grams
O Not enough stocks of Hopia for selling.
11
def change_name(self, new_name):
self.name = new_name
12
O An error will occur
13
14
15
def change_description(self, new_description):
2. What will be the output if the following lines of
16
self.description = new_description
are executed after the last line?
17
18
def change_category(self, new_category):
hopia.sell(20)
19
self.category = new_category
hopia.sell(20)
hopia.sell(20)
20
21
def change_weight(self, new_weight_in_grams):
hopia.sell(20)
hopia.eat(20)
22
self.weight_in_grams = new_weight_in_grams
23
print(hopia.stock)
def add_supplies(self, stocks_added):
self.stock += stocks_added
24
25
O a. Not enough stocks of Hopia for selling.
26
def sell(self, stocks_sold):
if self.stock > stocks_sold:
self.stock -- stocks_sold
27
O b. Not enough stocks of Hopia for selling.
28
20
29
Oc.
Not enough stocks of hopia for selling.
30
else:
print(f"Not enough stocks of {self.name} for selling.")
O d. An error will occur
31
32
O e. Not enough stocks of hopia for selling.
33 hopia = Product("Hopia", "food", 4, 100, 20)
20
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps

Knowledge Booster
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.Recommended textbooks for you

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education