Guest User

Untitled

a guest
Nov 23rd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. /**
  2. * This LabClass is for adding different cars in to set garages.
  3. *
  4. * @author (Henley Mumford)
  5. * @version (23.11.2017)
  6. */
  7. public class LabClass
  8. {
  9. // The car owners name
  10. private String drivername;
  11. // Which garage it is in.
  12. private String garage;
  13. // What date the car was checked in
  14. private String timeAndDay;
  15. // How many cars the garage can fit in
  16. private int capacity;
  17.  
  18. /**
  19. * Constructor for objects of class LabClass
  20. */
  21. public LabClass(int maxNumberOfCars)
  22. {
  23. drivername = "unknown";
  24. garage = "unknown";
  25. timeAndDay = "unknown";
  26. capacity = maxNumberOfCars;
  27. }
  28.  
  29. /**
  30. * Add a car to this LabClass.
  31. */
  32. public void addCar(Car newCar)
  33. {
  34. if (Car.size() == capacity) {
  35. System.out.println("This garage is full, please select another Garage.");
  36. }
  37. else {
  38. Car.add(newCar);
  39. }
  40. }
  41.  
  42. /**
  43. * Return the number of cars currently in this garage.
  44. */
  45. public int numberOfStudents()
  46. {
  47. return Car.size();
  48. }
  49. }
Add Comment
Please, Sign In to add comment