Guest User

Untitled

a guest
Jul 21st, 2019
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. package OOP.Polymorphism.Vehicles;
  2.  
  3. public class Truck extends Vehicle {
  4. private static final double ADDITIONAL_CONSUMPTION = 1.6;
  5.  
  6. public Truck(double fuelQuantity, double fuelConsumption, double tankCapacity) {
  7. super(fuelQuantity, fuelConsumption + ADDITIONAL_CONSUMPTION, tankCapacity);
  8. }
  9.  
  10. @Override
  11. public void refuel(double fuelQuantity) {
  12. super.refuel(fuelQuantity * 0.95);
  13. }
  14. }
Add Comment
Please, Sign In to add comment