Advertisement
fosterbl

DiscountedItem.java

Feb 18th, 2020
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1.   // DiscountedItem inherits from Item
  2. public class DiscountedItem extends Item{
  3.    // add an instance variable for the discount
  4.  
  5.    // Add constructors that call the super constructor
  6.  
  7.    // Add get/set methods for discount
  8.    public double getDiscount(){
  9.       return 0.0; // return discount here instead of 0
  10.    }
  11.  
  12.    // Add a toString() method that returns a call to the super toString
  13.    // and then the discount in parentheses using the super.valueToString() method
  14.  
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement