Guest User

Untitled

a guest
Jul 21st, 2019
238
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 Bus extends Vehicle {
  4. private static final double ADDITIONAL_CONSUMPTION = 1.4;
  5.  
  6. public Bus(double fuelQuantity, double fuelConsumption, double tankCapacity) {
  7. super(fuelQuantity, fuelConsumption + ADDITIONAL_CONSUMPTION, tankCapacity);
  8. }
  9.  
  10. public void reduceConsumption() {
  11. this.setFuelConsumption(this.getFuelConsumption() - 1.4);
  12. }
  13. }
Add Comment
Please, Sign In to add comment