Question 151
Given:

What is the result?

What is the result?
Question 152
Given:

And given the commands:

What is the result?

And given the commands:

What is the result?
Question 153
Given the following two classes:

How should you write methods in the ElectricAccount class at line n1 so that the member variable bill is always equal to the value of the member variable kwh multiplied by the member variable rate?
Any amount of electricity used by a customer (represented by an instance of the customer class) must contribute to the customer's bill (represented by the member variable bill) through the method useElectricity method. An instance of the customer class should never be able to tamper with or decrease the value of the member variable bill.


How should you write methods in the ElectricAccount class at line n1 so that the member variable bill is always equal to the value of the member variable kwh multiplied by the member variable rate?
Any amount of electricity used by a customer (represented by an instance of the customer class) must contribute to the customer's bill (represented by the member variable bill) through the method useElectricity method. An instance of the customer class should never be able to tamper with or decrease the value of the member variable bill.

Question 154
You are asked to develop a program for a shopping application, and you are given the following information:
* The application must contain the classes Toy, EduToy, and ConsToy. The Toy class is the superclass of the other two classes.
* The int calculatePrice (Toy t) method calculates the price of a toy.
* The void printToy (Toy t) method prints the details of a toy.
Which definition of the Toy class adds a valid layer of abstraction to the class hierarchy?
* The application must contain the classes Toy, EduToy, and ConsToy. The Toy class is the superclass of the other two classes.
* The int calculatePrice (Toy t) method calculates the price of a toy.
* The void printToy (Toy t) method prints the details of a toy.
Which definition of the Toy class adds a valid layer of abstraction to the class hierarchy?
Question 155
Given the code fragment:

What is the result?

What is the result?
