Advertisement
Tsuki11

Class CarFinal

Mar 13th, 2020
840
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. package MoreExercise_3_CarSalesMan02;
  2.  
  3. public class Car1 {
  4.  
  5.  
  6. public String getColor() {
  7. return this.color;
  8. }
  9.  
  10. public String getWeight() {
  11. return this.weight;
  12. }
  13.  
  14. public Engine1 getEngine() {
  15. return this.engine;
  16. }
  17.  
  18. public String getModel() {
  19. return this.model;
  20. }
  21.  
  22. public Car1(String model, Engine1 engine, String weight, String color) {
  23. this.model = model;
  24. this.engine = engine;
  25. this.weight = weight;
  26. this.color = color;
  27. }
  28.  
  29. private String model;
  30. private Engine1 engine;
  31. private String weight;
  32. private String color;
  33.  
  34. @Override
  35. public String toString() {
  36. return this.model + ":" +"\n"+ String.format("%s" +
  37. " Weight: %s%n" +
  38. " Color: %s",this.engine,this.weight,this.color);
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement