Advertisement
Guest User

JA-VA

a guest
Nov 23rd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. public class Car {
  2. private String registration;
  3. private int doors;
  4. private String colour;
  5. private CarDealer supplier;
  6. private static int totalCars = 0;
  7. public Car() {
  8. this.registration = null;
  9. this.doors = 0;
  10. this.colour = null;
  11. this.supplier = null;
  12. ++totalCars;
  13. }
  14. public Car(
  15. String registration,
  16. int doors,
  17. String colour,
  18. CarDealer supplier
  19. ){
  20. this.registration = registration;
  21. this.doors = doors;
  22. this.colour = colour;
  23. this.supplier = supplier;
  24. ++totalCars;
  25. }
  26.  
  27. public static int getTotalCars() {
  28. return totalCars;
  29. }
  30.  
  31. public static void setTotalCars(int totalCars) {
  32. Car.totalCars = totalCars;
  33. }
  34.  
  35. public String getColour() {
  36. return colour;
  37. }
  38.  
  39. public void setColour(String colour) {
  40. this.colour = colour;
  41. }
  42.  
  43. public void setRegistration(String registration) {
  44. this.registration = registration;
  45. }
  46.  
  47. public String getRegistration() {
  48. return registration;
  49. }
  50.  
  51. public CarDealer getSupplier() {
  52. return supplier;
  53. }
  54.  
  55. public void setSupplier(CarDealer supplier) {
  56. this.supplier = supplier;
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement