Question 1 When designing a class, what is one of the first tasks that need to b
ID: 3830050 • Letter: Q
Question
Question 1
When designing a class, what is one of the first tasks that need to be done?
Question options:
Defining the instance variables
Writing the method headers
Specifying the public interface
Adding comments to your program
Question 2
Recall the Cash Register class developed in the textbook. What is output by the following code segment?from cashregister2 import CashRegisterreg1 = CashRegister()
reg2 = reg1
reg1.addItem(3.00)
reg1.addItem(5.00)
reg2.clear()
print(reg1.getCount())
Question options
0
1
2
The program terminates with a runtime error
Question 3
Recall the Cash Register class developed in the textbook. What is output by the following code segment?from cashregister2 import CashRegisterreg1 = CashRegister()
reg1.addItem(3.00)
reg2 = reg1
reg1.addItem(5.00)
print(reg2.getCount())
Question options
0
1
2
The program terminates with a runtime error
Defining the instance variables
Writing the method headers
Specifying the public interface
Adding comments to your program
Explanation / Answer
Question 1
When designing a class, what is one of the first tasks that need to be done?
Answer: Defining the instance variables
Recall the Cash Register class developed in the textbook. What is output by the following code segment?from cashregister2 import CashRegisterreg1 = CashRegister()
reg2 = reg1
reg1.addItem(3.00)
reg1.addItem(5.00)
reg2.clear()
print(reg1.getCount())
Answer: 0
Question 3
Recall the Cash Register class developed in the textbook. What is output by the following code segment?from cashregister2 import CashRegisterreg1 = CashRegister()
reg1.addItem(3.00)
reg2 = reg1
reg1.addItem(5.00)
print(reg2.getCount())
Question options
Answer: 1
Answer:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.