Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.67 KB | None | 0 0
  1. package Homework5;
  2.  
  3. import java.util.Scanner;
  4. import Homework5.DinnerEvent;
  5. import Homework5.Employee;
  6.  
  7. public class StaffDinnerEvent {
  8.  
  9. public static int guestNumber;
  10. public static String eventNumber;
  11. public static String phoneNumber;
  12. public static int eventType;
  13. public static int entree;
  14. public static int side;
  15. public static int side1;
  16. public static int side2;
  17. public static int dessert;
  18. static DinnerEvent Dinner1;
  19. public static int employeeNum;
  20. public static String first;
  21. public static String last;
  22. public static double payRate;
  23. public static String jobTitle;
  24.  
  25. static int waitstaff;
  26. static int bartenders;
  27. static int coordinators;
  28. static int numEmps;
  29.  
  30. public static void main(String[] args) {
  31.  
  32. DinnerEvent Dinner1 = new DinnerEvent(eventNumber, guestNumber, phoneNumber, eventType, entree, side1, side2, dessert);
  33.  
  34. Dinner1.setEventNumber(eventNumber());
  35. Dinner1.setGuests(guestNumber());
  36. Dinner1.setPhoneNumber(phoneNumber());
  37. Dinner1.setEventType(eventType());
  38. Dinner1.setEntree(entree());
  39. Dinner1.setSide(sides(),sides());
  40. Dinner1.setDessert(dessert());
  41.  
  42. employees(Dinner1);
  43. display(Dinner1);
  44.  
  45. }
  46.  
  47. public static int guestNumber()
  48. {
  49. Scanner user_input = new Scanner( System.in );
  50. System.out.print ("Enter the number of guests attending: ");
  51. guestNumber = user_input.nextInt();
  52. int a = guestNumber;
  53.  
  54. while ((a < 5) || (a > 100))
  55. {
  56. Scanner user_input3 = new Scanner( System.in );
  57. System.out.print ("Enter the number of guests attending: ");
  58. a = user_input3.nextInt();
  59. }
  60. guestNumber = a;
  61. return guestNumber;
  62. }
  63. public static String eventNumber()
  64. {
  65. Scanner user_input2 = new Scanner ( System.in );
  66. System.out.print ("Enter the event number: ");
  67. eventNumber = user_input2.nextLine();
  68. return eventNumber;
  69. }
  70. public static String phoneNumber()
  71. {
  72. Scanner user_input3 = new Scanner ( System.in );
  73. System.out.print("Enter a contact phone number: ");
  74. phoneNumber = user_input3.nextLine();
  75. return phoneNumber;
  76. }
  77. public static int eventType()
  78. {
  79. Scanner user_input8 = new Scanner ( System.in );
  80. System.out.println("Enter the number for the correct event type: ");
  81. System.out.println("1: Wedding");
  82. System.out.println("2: Baptism");
  83. System.out.println("3: Birthday");
  84. System.out.println("4: Corporate");
  85. System.out.println("5: Other");
  86.  
  87. eventType = user_input8.nextInt();
  88. return eventType;
  89. }
  90. public static int entree()
  91. {
  92. Scanner user_input4 = new Scanner ( System.in );
  93. System.out.print ("Entree Options: \n" + "1: Chicken" + "\n2: Steak" + "\n3: Fish\n");
  94. entree = user_input4.nextInt();
  95. return entree-1;
  96. }
  97. public static int sides()
  98. {
  99. Scanner user_input5 = new Scanner ( System.in );
  100. System.out.print ("Side Options: \n" + "1: Vegetables" + "\n2: Fruits" + "\n3: Mac & Cheese\n");
  101. side = user_input5.nextInt();
  102. return side-1;
  103. }
  104. public static int dessert()
  105. {
  106. Scanner user_input6 = new Scanner ( System.in );
  107. System.out.print ("Dessert Options: \n" + "1: Chocolate Cake" + "\n2: Vanilla Ice Cream" + "\n3: Brownie a la Mode\n");
  108. dessert = user_input6.nextInt();
  109. return dessert-1;
  110. }
  111.  
  112. public static void employees(DinnerEvent a)
  113. {
  114. waitstaff = (a.getGuestNumber() / 10) + 1;
  115. bartenders = (a.getGuestNumber() / 25);
  116. coordinators = 1;
  117. numEmps = waitstaff + bartenders + coordinators;
  118. for (int b = 0; b < coordinators; ++b)
  119. {
  120. a.setEmp(new Coordinator(employeeNum, first, last, payRate, jobTitle), b);
  121. }
  122.  
  123. for (int x = 1; x <= waitstaff; ++x)
  124. {
  125. a.setEmp(new Waitstaff(employeeNum, first, last, payRate, jobTitle), x);
  126. }
  127. for (int y = (waitstaff + 1); y <= (bartenders + waitstaff); ++y)
  128. {
  129. a.setEmp(new Bartender(employeeNum, first, last, payRate, jobTitle), y);
  130. }
  131.  
  132. for (int z = 0; z < numEmps; ++z)
  133. {
  134. Scanner user_input7 = new Scanner ( System.in );
  135. System.out.println("Enter the first name of the employee: ");
  136. first = user_input7.nextLine();
  137. a.employees[z].setFirst(first);
  138.  
  139. Scanner user_input8 = new Scanner ( System.in );
  140. System.out.println("Enter the last name of the employee: ");
  141. last = user_input8.nextLine();
  142. a.employees[z].setLast(last);
  143.  
  144. Scanner user_input9 = new Scanner ( System.in );
  145. System.out.println("Enter the employee number: ");
  146. employeeNum = user_input9.nextInt();
  147. a.employees[z].setEmpNum(employeeNum);
  148.  
  149. Scanner user_input10 = new Scanner ( System.in );
  150. System.out.println("Enter the pay rate of the employee: ");
  151. payRate = user_input9.nextDouble();
  152. a.employees[z].setPay(payRate);
  153.  
  154. a.employees[z].setTitle();
  155. }
  156. }
  157.  
  158. public static void display(DinnerEvent a)
  159. {
  160. System.out.println("The Event Number is: " + a.getEventNumber());
  161. System.out.println("The Number of Guests is: " + a.getGuestNumber());
  162. System.out.println("The Phone Number is: " + a.getPhoneNumber());
  163. System.out.println("The Event Type is: " + a.getEventType());
  164. System.out.println("The Entree choice is: " + a.getEntree());
  165. System.out.println("The first Side choice is: " + a.getSide1());
  166. System.out.println("The second Side choice is: " + a.getSide2());
  167. System.out.println("The Dessert choice is: " + a.getDessert());
  168.  
  169. for (int x = 0; x < numEmps; ++x)
  170. {
  171. System.out.print("The employees details are as follows: ");
  172. System.out.println("First name: " + a.employees[x].getFirst());
  173. System.out.println("Last Name: " + a.employees[x].getLast());
  174. System.out.println("Employee Number: " + a.employees[x].getEmpNum());
  175. System.out.println("Pay Rate: " + a.employees[x].getPay());
  176. System.out.println("Job Title: " + a.employees[x].getTitle());
  177.  
  178. }
  179. }
  180.  
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement