Advertisement
petar088

Car

Oct 13th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. package _13_DEFINING_CLASSES.Exercise_Class._5_Car_Salesman_;
  2.  
  3. public class Car {
  4. private String model;
  5. private String engine;
  6. private int weight;
  7. private String color;
  8. private int power;
  9. private int displacement;
  10. private String efficiency;
  11.  
  12. public Car(String model, String engine, int weight, String color,int power, int displacement, String efficiency){
  13. this.model = model;
  14. this.engine = engine;
  15. this .weight = weight;
  16. this.color = color;
  17. this.power = power;
  18. this.displacement = displacement;
  19. this.efficiency = efficiency;
  20. }
  21. public Car(String model, String engine, int weight,int power, int displacement, String efficiency){
  22. this.model = model;
  23. this.engine = engine;
  24. this .weight = weight;
  25. this.color = "n/a";
  26. this.power = power;
  27. this.displacement = displacement;
  28. this.efficiency = efficiency;
  29. }
  30. public Car(String model, String engine, String color,int power, int displacement, String efficiency){
  31. this.model = model;
  32. this.engine = engine;
  33. this .weight = -1;
  34. this.color = color;
  35. this.power = power;
  36. this.displacement = displacement;
  37. this.efficiency = efficiency;
  38. }
  39. public Car(String model, String engine,int power, int displacement, String efficiency){
  40. this.model = model;
  41. this.engine = engine;
  42. this .weight = -1;
  43. this.color = "n/a";
  44. this.power = power;
  45. this.displacement = displacement;
  46. this.efficiency = efficiency;
  47. }
  48. public String getModel() {
  49. return model;
  50. }
  51.  
  52. public void setModel(String model) {
  53. this.model = model;
  54. }
  55.  
  56. public String getEngine() {
  57. return engine;
  58. }
  59.  
  60. public void setEngine(String engine) {
  61. this.engine = engine;
  62. }
  63.  
  64. public int getWeight() {
  65. return weight;
  66. }
  67.  
  68. public void setWeight(int weight) {
  69. this.weight = weight;
  70. }
  71.  
  72. public String getColor() {
  73. return color;
  74. }
  75.  
  76. public void setColor(String color) {
  77. this.color = color;
  78. }
  79.  
  80. public int getPower() {
  81. return power;
  82. }
  83.  
  84. public void setPower(int power) {
  85. this.power = power;
  86. }
  87.  
  88. public int getDisplacement() {
  89. return displacement;
  90. }
  91.  
  92. public void setDisplacement(int displacement) {
  93. this.displacement = displacement;
  94. }
  95.  
  96. public String getEfficiency() {
  97. return efficiency;
  98. }
  99.  
  100. public void setEfficiency(String efficiency) {
  101. this.efficiency = efficiency;
  102. }
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement