Advertisement
Guest User

Untitled

a guest
May 31st, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.63 KB | None | 0 0
  1. QUEUE LAB/DATA FILES
  2.  
  3.  
  4. Advanced Computer Science
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11. Lab Goal : The lab was designed to teach you more about Queues
  12.  
  13.  
  14. Lab Description : You will create a priority queue simulating a school lunch line to help the lunch ladies better organize the lunch at Rosemount high school based on the grade and status of the customer.
  15.  
  16.  
  17. Lab Data:
  18. Dr. R 13
  19. Will 12
  20. Anshul 11
  21. Vanessa 10
  22. Patty 12
  23. Jimmy 9
  24. Ashley 10
  25. Bungert 13
  26. Trae 9
  27. McKeever 11
  28. Lab Output:
  29. Dr. R
  30. Bungert
  31. Will
  32. Patty
  33. McKeever
  34. Anshul
  35. Ashley
  36. Vanessa
  37. Jimmy
  38. Trae
  39.  
  40.  
  41.  
  42. public class customer implements Comparable<customer> {
  43. String name;
  44. int rank;
  45. public customer(String n, int r)
  46. {
  47.  
  48. }
  49. public void setName(String n)
  50. {
  51.  
  52. }
  53. public String getName()
  54. {
  55. return"";
  56. }
  57. public int getRank()
  58. {
  59. return 0
  60. }
  61. public void setRank(int r)
  62. {
  63.  
  64. }
  65. public int compareTo(customer c)
  66. {
  67. return 0;
  68. }
  69. public String toString()
  70. {
  71. return"";
  72. }
  73. }
  74.  
  75. import java.util.PriorityQueue;
  76.  
  77. public class lunchLine {
  78. private PriorityQueue<customer> lunch;
  79. public lunchLine(){
  80. lunch=new PriorityQueue<customer>();
  81. }
  82. public void add(customer c)
  83. {
  84.  
  85. }
  86. public customer remove()
  87. {
  88.  
  89. }
  90. public String showLine()
  91. {
  92. //shows the whole lunch line without removing it
  93. }
  94.  
  95. }
  96. }
  97.  
  98. public class lunchLineRunner {
  99. public static void main ( String[] args )
  100. {
  101. lunchLine line=new lunchLine();
  102. //add test cases and test your methods
  103. }
  104.  
  105.  
  106.  
  107.  
  108. STACK LAB/DATA FILES
  109.  
  110. Advanced Computer Science
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117. Lab Goal : The lab was designed to teach you more about Stacks
  118.  
  119.  
  120. Lab Description : In this lab you will simulate the experience of a teacher in the modern day school system; that is, the first one hired is the first one fired or first in, first out. This situation is perfect for a stack. Have fun!
  121.  
  122. Sample Output:
  123. Teacher Roster:: Medlin
  124.  
  125. Teacher Roster:: Bungert
  126. Reinartz
  127. Fendrich
  128. Bender
  129. Brooks
  130. Medlin
  131.  
  132. Teacher Roster:: Wu
  133. Bungert
  134. Reinartz
  135. Fendrich
  136. Bender
  137. Brooks
  138. Medlin
  139.  
  140. Teacher Roster: Bungert
  141. Reinartz
  142. Fendrich
  143. Bender
  144. Brooks
  145. Medlin
  146.  
  147. Teacher Roster:: Early
  148. Bungert
  149. Reinartz
  150. Fendrich
  151. Bender
  152. Brooks
  153. Medlin
  154.  
  155. Teacher Roster:: Graham
  156. Johnson
  157. Young
  158. Jones
  159. Smith
  160. Bungert
  161. Reinartz
  162. Fendrich
  163. Bender
  164. Brooks
  165. Medlin
  166.  
  167. Teacher Roster:: Jones
  168. Smith
  169. Bungert
  170. Reinartz
  171. Fendrich
  172. Bender
  173. Brooks
  174. Medlin
  175.  
  176. package CompSciFinal;
  177.  
  178. import java.util.Stack;
  179.  
  180. public class teacherDump {
  181.  
  182.  
  183. public teacherDump()
  184. {
  185.  
  186. }
  187. public void hire(String t)
  188. {
  189. //hire a new teacher
  190.  
  191. }
  192. public String fire()
  193. {
  194.  
  195. //fire a teacher
  196.  
  197. }
  198. public String showListOfTeachers()
  199. {
  200. return "";
  201. }
  202. }
  203.  
  204.  
  205. package CompSciFinal;
  206.  
  207. public class teacherDumpRunner {
  208. public static void main ( String[] args )
  209. {
  210. teacherDump teach=new teacherDump();
  211. teach.hire("Medlin");
  212. System.out.println(teach.showListOfTeachers());
  213. teach.hire("Brooks");
  214. teach.hire("Bender");
  215. teach.hire("Fendrich");
  216. teach.hire("Reinartz");
  217. teach.hire("Bungert");
  218. System.out.println(teach.showListOfTeachers());
  219. teach.hire("Wu");
  220. System.out.println(teach.showListOfTeachers());
  221. teach.fire();
  222. System.out.println(teach.showListOfTeachers());
  223. teach.hire("Early");
  224. System.out.println(teach.showListOfTeachers());
  225. teach.fire();
  226. teach.hire("Smith");
  227. teach.hire("Jones");
  228. teach.hire("Young");
  229. teach.hire("Johnson");
  230. teach.hire("Graham");
  231. System.out.println(teach.showListOfTeachers());
  232. teach.fire();
  233. teach.fire();
  234. teach.fire();
  235. System.out.println(teach.showListOfTeachers());
  236.  
  237. }
  238. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement