Advertisement
NatasaZ

Automobil

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