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...


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?


400:


 Suppose class D is derived from class B, the method doStuff() has protected


access in class B, and the classes D and B are in different packages, so the class


definitions begin as follows:


package one;


public class B


{


 protected void doStuff()


 {


 ...


}


package two;


import one.B;


public class D extends B


{


 ...


}


 Is the following a legitimate method that can appear in the definition of the class D?


public void demo()


{


 doStuff();//doStuff is inherited from B.


}



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here