Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.53 KB | None | 0 0
  1. Rules:
  2.  
  3. You may NOT use any other resources other than your IDE and the Java Documentation website to solve this problem.
  4. The only other website you may visit is our BrightSpace course for the purpose of submitting your solution and reading these instructions.
  5. You may have one-side of one page of hand-written notes beside you, your name and student number must appear on one of the sides.
  6. Differences from the requirements below, will result in marks removed so pay close attention.
  7. Compile errors will result in a 0, so code in small iterations, compile and test often.
  8. Compile warnings will decrease your mark so ensure they are all addressed prior to handing in your solution.
  9. Anything displayed inside <> brackets included, should be replaced with real values. For example, <input> would be replaced with 7 if the user input into the keyboard a 7.
  10. Your programming style will be evaluated so maintain your indentation and such
  11. Javadoc and other comments will not be evaluated.
  12.  
  13. On your laptop:
  14.  
  15. Open your IDE; create a NEW WORKSPACE called c:\CST8130Exam
  16. Note – if you are working on a MAC, choose an appropriate name rather directly in the root directory
  17.  
  18. Classes to Create:
  19.  
  20. create a new Project called MyNameLabTest (for example, MelissaSienkiewiczLabTest), all classes MUST be added to the default package.
  21. create a new class with method main called LabTest
  22. create another new class called Student
  23. data members include: studentNumber (int), studentName (String) and balance (float)
  24. create another new class called CollegeRegistrar
  25. data members include: students (ArrayList of Students), name (String)
  26.  
  27. Programming Instructions:
  28.  
  29. Using Object Oriented Principles, write a program which produces the code as indicated in the following specifications:
  30. Your program must be a console application that provides a user this exact menu:
  31.  
  32. Please select one of the following:
  33. 1: Add Student to College Registrar
  34. 2: Display Students in the Registrar
  35. 3: Set College Registrar Name
  36. 4: Search for a Student
  37. 5: Exit
  38. Enter your Selection: <keyboard input here>
  39.  
  40. The menu must be displayed repeatedly until 5 is selected
  41. If the user enters an invalid menu choice, you must display the error "Unsupported choice" and display the menu again.
  42. When the user selects menu item 1:
  43. The program will read data from the keyboard to create a new Student and add it to the CollegeRegistrar, the user will be asked to input as follows:
  44.  
  45. Please Enter the Student's Name: <keyboard input here>
  46. Please Enter the Student Number: <keyboard input here>
  47. Please Enter the Student's Balance: <keyboard input here>
  48.  
  49. If invalid input is encountered, the error message "Incorrect format" must be displayed and input is terminated, the student is not created nor added to the CollegeRegistrar. The menu should then be displayed again.
  50. The student list must remain in sorted order by Student Number, you may use the Collection class methods or do this manually. The more efficient you are, the higher your mark.
  51. You are able to create a get method for studentNumber if you deem this necessary.
  52. To simplify this exam, ignore the issues that could occur if a duplicate studentNumber is specified. Do not test your code with duplicate studentNumbers and neither will I.
  53. When the user selects menu item 2:
  54. The program will display the following information:
  55.  
  56. College Registrar Information:
  57. Name: <display business name here>
  58. Student List:
  59. Student #: <student number>, Name: <student name>, Balance: $<balance>
  60. Student #: <student number>, Name: <student name>, Balance: $<balance>
  61. Student #: <student number>, Name: <student name>, Balance: $<balance>
  62. ...
  63.  
  64. If no College Registrar name is set yet, "Unknown" must be displayed
  65. If no students are added to the College Registrar yet, "No Students in College Registrar" must be displayed
  66. When the user selects menu item 3:
  67. The program will read data from the keyboard to set the name of the college registrar, the user will be asked to input as follows:
  68.  
  69. Please Enter the College Registrar's Name: <keyboard input here>
  70.  
  71. Consider any non-blank input a valid name.
  72. When the user selects menu item 4:
  73. The program will read data from the keyboard to search for a student given the student number, the user will be asked to input as follows:
  74.  
  75. Please Enter the Student Number to Search for: <keyboard input here>
  76.  
  77. If invalid input is entered, the error message "Incorrect format" must be displayed and no search is performed. The main menu must be displayed.
  78. The search should be performed using the most efficient search you know, you are able to use Collection class methods or create your own.
  79. If the search does not succeed, the message "Student not found in College Registrar" must be displayed.
  80. If the search succeeds, the following message should be displayed where index is filled in with the zero based index where the student is stored in the Student List:
  81.  
  82. Student found at index <index>
  83. Student #: <student number>, Name: <student name>, Balance: $<balance>
  84.  
  85. When the user selects menu item 5:
  86. The program must display the message "Exiting..." and then terminate/end the program.
  87.  
  88. Sample Output: green is user input
  89.  
  90. Please select one of the following:
  91. 1: Add Student to College Registrar
  92. 2: Display Students in the Registrar
  93. 3: Set College Registrar Name
  94. 4: Search for a Student
  95. 5: Exit
  96. Enter your Selection: 2
  97. College Registrar Information:
  98. Name: Unknown
  99. Student List:
  100. No Students in College Registrar
  101.  
  102. Please select one of the following:
  103. 1: Add Student to College Registrar
  104. 2: Display Students in the Registrar
  105. 3: Set College Registrar Name
  106. 4: Search for a Student
  107. 5: Exit
  108. Enter your Selection: 1
  109. Please Enter the Student's Name: Melissa Sienkiewicz
  110. Please Enter the Student Number: 112233
  111. Please Enter the Student's Balance: $1150
  112.  
  113. Please select one of the following:
  114. 1: Add Student to College Registrar
  115. 2: Display Students in the Registrar
  116. 3: Set College Registrar Name
  117. 4: Search for a Student
  118. 5: Exit
  119. Enter your Selection: 1
  120. Please Enter the Student's Name: Tom Sienkiewicz
  121. Please Enter the Student Number: 112231
  122. Please Enter the Student's Balance: $100
  123.  
  124. Please select one of the following:
  125. 1: Add Student to College Registrar
  126. 2: Display Students in the Registrar
  127. 3: Set College Registrar Name
  128. 4: Search for a Student
  129. 5: Exit
  130. Enter your Selection: 1
  131. Please Enter the Student's Name: Jakub Sienkiewicz
  132. Please Enter the Student Number: 112232
  133. Please Enter the Student's Balance: $10000.99
  134.  
  135. Please select one of the following:
  136. 1: Add Student to College Registrar
  137. 2: Display Students in the Registrar
  138. 3: Set College Registrar Name
  139. 4: Search for a Student
  140. 5: Exit
  141. Enter your Selection: 3
  142. Please Enter the College Registrar's Name: Algonquin College
  143.  
  144. Please select one of the following:
  145. 1: Add Student to College Registrar
  146. 2: Display Students in the Registrar
  147. 3: Set College Registrar Name
  148. 4: Search for a Student
  149. 5: Exit
  150. Enter your Selection: 2
  151. College Registrar Information:
  152. Name: Algonquin College
  153. Student List:
  154. Student #: 112231, Name: Tom Sienkiewicz, Balance: $100.00
  155. Student #: 112232, Name: Jakub Sienkiewicz, Balance: $10000.99
  156. Student #: 112233, Name: Melissa Sienkiewicz, Balance: $1150.00
  157.  
  158. Please select one of the following:
  159. 1: Add Student to College Registrar
  160. 2: Display Students in the Registrar
  161. 3: Set College Registrar Name
  162. 4: Search for a Student
  163. 5: Exit
  164. Enter your Selection: 4
  165. Please Enter the Student Number to Search for: 112232
  166. Student found at index 1
  167. Student #: 112232, Name: Jakub Sienkiewicz, Balance: $10000.99
  168.  
  169. Please select one of the following:
  170. 1: Add Student to College Registrar
  171. 2: Display Students in the Registrar
  172. 3: Set College Registrar Name
  173. 4: Search for a Student
  174. 5: Exit
  175. Enter your Selection: 4
  176. Please Enter the Student Number to Search for: 1
  177. Student not found in College Registrar
  178.  
  179. Please select one of the following:
  180. 1: Add Student to College Registrar
  181. 2: Display Students in the Registrar
  182. 3: Set College Registrar Name
  183. 4: Search for a Student
  184. 5: Exit
  185. Enter your Selection: 4
  186. Please Enter the Student Number to Search for: 200000
  187. Student not found in College Registrar
  188.  
  189. Please select one of the following:
  190. 1: Add Student to College Registrar
  191. 2: Display Students in the Registrar
  192. 3: Set College Registrar Name
  193. 4: Search for a Student
  194. 5: Exit
  195. Enter your Selection: 6
  196. Unsupported choice
  197.  
  198. Please select one of the following:
  199. 1: Add Student to College Registrar
  200. 2: Display Students in the Registrar
  201. 3: Set College Registrar Name
  202. 4: Search for a Student
  203. 5: Exit
  204. Enter your Selection: e
  205. Your choice is invalid
  206.  
  207. Please select one of the following:
  208. 1: Add Student to College Registrar
  209. 2: Display Students in the Registrar
  210. 3: Set College Registrar Name
  211. 4: Search for a Student
  212. 5: Exit
  213. Enter your Selection: 5
  214. Exiting...
  215.  
  216. Submission Instructions:
  217.  
  218. Create a zip file of your workspace directory (zip the directory c:\CST8130Exam or comparable Mac folder)
  219. Upload the zip file to Brightspace, please note, that only one zip file is permitted and only the one submission is allowed
  220. Celebrate, you are done!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement