Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. UML diagram for project 2
  2.  
  3. Implement the 3 classes in the UML diagram above. More details are below.
  4.  
  5. You may add any additional *non-public* methods that you want (including 'package protected'
  6.  
  7. The Child Class:
  8.  
  9. Needs to have the five instance variables and one class/static variable shown in the diagram
  10. nextID is the class variable.
  11. The constructor should take three parameters.
  12. it must initialize the instance variable Name with the name param
  13. it must initialize the instance variable siblingInProgram with the siblingPlan param
  14. it must initialize the instance variable age with the currentAge param
  15. initialize the yearsOfAttendance instance variable to 0
  16. the dayCareID instance variable should be assigned the value of the nextID static class variable
  17. the nextID class variable should be incremented.
  18. The CalculateBill method should
  19. charge according to the following schedule:
  20. Age Rate
  21. birth to 1 year 400
  22. 1-2 years 300
  23. 3-4 years 200
  24. over 4 150
  25. If the child has a sibling in the program, give the child a 10% discount
  26. After the sibling discount, give the child an additional $10 discount for every year of attendance.
  27. The DayCareWorker Class:
  28.  
  29. Needs to have 3 instance variables as per the diagram
  30. The constructor should take two parameters
  31. the Name instance variable should be initialized by the name parameter
  32. the salary instance variable should be initialized by the startingPay parameter
  33. thechildrenInGroup instance variable should be initialized to a new ArrayList of Child (which is currently empty)
  34. The performanceReview method
  35. generate a random number from 1-5 (representing poor, below expectations, meets expectations, exceeds expectations and spectacular),
  36. based on the performance review, increase the salary of the dayCareWorker
  37. Review Salary increase
  38. poor (1) 0%
  39. below Expectations(2) 1%
  40. Meets Expectations(3) 2.5%
  41. Exceeds Expectations (4) 3.5%
  42. Spectacular (5) 5%
  43. The performFireDrill method
  44. loops through all of the children in the group and report (print) that they are safe
  45. The getXXX methods
  46. accessor for the correct instance variable.
  47. the RemoveChild method (note diagram incomplete!!!! the return type is Optional<Child>)
  48. look through the childrenInGroup list and find the child with the matching id. remove the child from the childrenInGroup list and return an Optional containing that child, if the child is not in the list return an Optional of null.
  49.  
  50. The DayCareFacility Class:
  51.  
  52. Needs two instance variables as specified in the diagram.
  53. The main function ( public static void main)
  54. must only have two lines:
  55. create a new DayCareFacility Object
  56. call runDayCare on that object
  57. The constructor
  58. must initialize the two instance variables to new empty arrayLists of the appropriate type
  59. The runDayCare method:
  60. feel free to break this method into pieces and make private methods to do parts of what is listed here. (and just call those private methods from this one)
  61. needs to display the top level menu which should provide the following options: (give visual feedback to the user for each)
  62. Admit Child
  63. prompt the user to enter the details you need
  64. create a new child object
  65. randomly select a dayCareWorker from the list to be the worker assigned to that child.
  66. add the child to the list of children instance variable
  67.  
  68. hire worker
  69. prompt the user to enter the details that you need
  70. create a new DayCareWorker object
  71. add the worker to the list of workers instance variable
  72. Students go to school
  73. all of the students who are 6 or older should be removed from the system - both from the lists in the DayCareFacility and from the DayCareWorkers lists
  74. RunFireDrill
  75. call the fireDrill method on each DayCareWorker
  76. exit
  77. end the program
  78. End of year:
  79. go through all the students and add one to their age and add one to their years at the facility
  80. go through all of the DayCareWorkers and call their performance review method
  81. DoAccounting
  82. run calculateBill on all the students and getSalary on all of the workers and see of the facility is making or losing money (is the total salary less or more than the total bills.) report this to the user.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement