Advertisement
Guest User

vehicle_catalogue

a guest
Feb 21st, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. package vehicle_catalogue;
  2.  
  3. public class Vehicle {
  4. String typeOfVehicle;
  5. String model;
  6. String color;
  7. int horsePower;
  8.  
  9. Vehicle(String typeOfVehicle, String model, String color, int horsePower) {
  10. this.typeOfVehicle = typeOfVehicle;
  11. this.model = model;
  12. this.color = color;
  13. this.horsePower = horsePower;
  14. }
  15.  
  16. public String getModel() {
  17. return model;
  18. }
  19.  
  20. public int getHorsePower() {
  21. return horsePower;
  22. }
  23.  
  24. @Override
  25. public String toString() {
  26. return String.format("Type: %s%n" + "Model: %s%n"
  27. + "Color: %s%n" + "Horsepower: %d", this.typeOfVehicle, this.model
  28. , this.color, this.horsePower);
  29.  
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement