Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.Scanner;
  3.  
  4. public class DayCareFacility{
  5.  
  6. private ArrayList<Child> students;
  7. private ArrayList<DayCareWorker> employees;
  8. public static void main(String[] args) {
  9. var DayCare = new DayCareFacility();
  10. DayCare.RunDayCare();
  11. }
  12. public DayCareFacility(){
  13. students = new ArrayList<Child>();
  14. employees = new ArrayList<DayCareWorker>();
  15.  
  16.  
  17.  
  18.  
  19. }
  20. public void RunDayCare() {
  21. while(true) {
  22. printMenu();
  23. selectOption();
  24.  
  25. }
  26. }
  27.  
  28.  
  29.  
  30. public void selectOption() {
  31. Scanner scanLines = new Scanner(System.in);
  32. var userChoice = scanLines.nextInt();
  33. switch(userChoice){
  34. case 1:
  35. System.out.println("What is the name of the Student?");
  36. var stuName = scanLines.nextLine();
  37. System.out.println("Do you have any siblings in the program?");
  38. boolean sibPlan = scanLines.nextBoolean();
  39. System.out.println("How old is the student?");
  40. var stuAge = scanLines.nextInt();
  41. Child admittedChild = new Child(stuName, sibPlan, stuAge);
  42. int randomIndex = (int) (Math.random() * employees.size());
  43. System.out.println( "Your child will be assigned to " + employees.get( randomIndex ) + "." );
  44. students.add(admittedChild);
  45. break;
  46. case 2:
  47. System.out.println("What will be the worker's starting salary?");
  48. float salInput = scanLines.nextFloat();
  49. System.out.println("What is the worker's name?");
  50. var workerName = scanLines.nextLine();
  51. DayCareWorker newWorker = new DayCareWorker(salInput, workerName);
  52. employees.add(newWorker);
  53. case 3:
  54. // for
  55. // }
  56. case 4:
  57. DayCareWorker driller = new DayCareWorker(0, "driller");
  58. }
  59. case 5:
  60. System.exit(0);
  61. case 6:
  62.  
  63. case 7:
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81. }
  82. }
  83.  
  84.  
  85.  
  86.  
  87. private void printMenu() {
  88. System.out.println("What operation would you like next:");
  89. System.out.println("(enter the operation number)");
  90. System.out.println("[1] Admit Child");
  91. System.out.println("[2] Hire Worker");
  92. System.out.println("[3] Students go to school");
  93. System.out.println("[4] Run fire drill");
  94. System.out.println("[5] Quit");
  95. System.out.println("[6] End of year");
  96. System.out.println("[7] Do Accounting");
  97.  
  98. }
  99.  
  100.  
  101.  
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement