Advertisement
NatasaZ

TeretnoVozilo

Nov 13th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. public class TeretnoVozilo extends Vozilo {
  2.  
  3. /*
  4. * Teretno vozilo je vozilo koje troši gorivo na sledeći način:
  5. * 3*(1.1*potrošnja)*predjeni_put. Moze se ispisati u sledećem obliku: Teretno -
  6. * Ser_broj{reg_broj}[gorivo/rezervoar] - potrosnja L/100km
  7. */
  8.  
  9. public TeretnoVozilo(String regBr, String serBr, double velRez, double trenGor, double potrosnja) {
  10. super(regBr, serBr, velRez, trenGor, potrosnja);
  11.  
  12. }
  13.  
  14. public TeretnoVozilo() {
  15. super();
  16. }
  17.  
  18. @Override
  19. double getBrKm(double n) {
  20. double s = 0;
  21. if (this.getTrenGor() >0) {
  22. s = this.getTrenGor() * 100 / 3 * (1.1 * this.getPotrosnja());
  23. }
  24. return s;
  25. }
  26.  
  27. @Override
  28. public void info() {
  29. System.out.println("Teretno vozilo - " + this.getSerBr() + "{" + this.getRegBr() + "} [" + this.getTrenGor()
  30. + "/" + this.getVelRez() + "]" + " - " + this.getPotrosnja() + " L/100km");
  31. }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement