Question: Please answer all the 4 questions below with explanation: Suppose the class named DiscountSale is a derived class of a class called Sale. Suppose the

Please answer all the 4 questions below with explanation:

Suppose the class named DiscountSale is a derived class of a class called Sale. Suppose the class Sale has instance variables named price and numberOfItems. Will an object of the class DiscountSale also have instance variables named price and numberOfItems?

Suppose the class named DiscountSale is a derived class of a class called Sale, and suppose the class Sale has public methods named getTotal and getTax. Will an object of the class DiscountSale have methods named getTotal and getTax? If so, do these methods have to perform the exact same actions in the class DiscountSale as in the class Sale?

Suppose the class named DiscountSale is a derived class of a class called Sale, and suppose the class Sale has a method with the following heading and no other methods named getTax, as follows:

 public double getTax() 

And suppose the definition of the class DiscountSale has a method definition with the following heading and no other method definitions for methods named getTax, as follows:

public double getTax(double rate) How many methods named getTax will the class DiscountSale have and what are their headings?

The class HourlyEmployee (Display 7.3) has methods named getName and getRate (among others). Why does the definition of the class HourlyEmployee contain a definition of the method getRate but no definition of the method getName?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!