Treyzania

reddit help

Nov 6th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. public class CarpetCost {
  2.    
  3.     // Other variables are unused, so I dropped them.
  4.     private double labourCharge;
  5.    
  6.     public CarpetCost(double cost) {
  7.         this.labourCharge = cost
  8.     }
  9.    
  10.     // Good practice to make getters for private values, if applicable.
  11.     public double getCost() {
  12.         return this.labourCharge;
  13.     }
  14.    
  15.     public boolean isDiscount() {
  16.        
  17.         // Don't need any if statements as the value we're looking for is the expression to find it.
  18.         return this.labourCharge <= 100;
  19.        
  20.     }
  21.    
  22. }
Add Comment
Please, Sign In to add comment