QuestionQ226
Working with Methods and EncapsulationGiven these two classes:

Any electricity amount used by a customer, represented by an instance of the Customer class, must contribute to that customer's bill, represented by the member variable bill, through the useElectricity method.
An instance of the Customer class must never be able to alter or reduce the value of the member variable bill.
How should the methods in the ElectricAccount class be written at line n1 so that bill always equals the value of kWh multiplied by the value of rate?
- A

- B

- C

- D

Community Discussion