Advertisement
Guest User

Untitled

a guest
Jul 20th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. public class Volvo extends Vehicles implements Drive {
  2. private double price;
  3.  
  4.  
  5. public Volvo(String m, double price) {
  6. super(m);
  7. this.price = price;
  8. }
  9.  
  10.  
  11. public static void main(String[] args) {
  12. Volvo v=new Volvo("Great", 12000.00);
  13. v.display();
  14. System.out.println("Price: "+v.price);
  15. v.startEngine();
  16. v.stopEngine();
  17.  
  18.  
  19. }
  20.  
  21.  
  22. @Override
  23. public void startEngine() {
  24. System.out.println("Engine Started! ");
  25.  
  26. }
  27.  
  28.  
  29. @Override
  30. public void stopEngine() {
  31. System.out.println("Engine Stopped!");
  32.  
  33. }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement