Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote