Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- QUEUE LAB/DATA FILES
- Advanced Computer Science
- Lab Goal : The lab was designed to teach you more about Queues
- 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.
- Lab Data:
- Dr. R 13
- Will 12
- Anshul 11
- Vanessa 10
- Patty 12
- Jimmy 9
- Ashley 10
- Bungert 13
- Trae 9
- McKeever 11
- Lab Output:
- Dr. R
- Bungert
- Will
- Patty
- McKeever
- Anshul
- Ashley
- Vanessa
- Jimmy
- Trae
- public class customer implements Comparable<customer> {
- String name;
- int rank;
- public customer(String n, int r)
- {
- }
- public void setName(String n)
- {
- }
- public String getName()
- {
- return"";
- }
- public int getRank()
- {
- return 0
- }
- public void setRank(int r)
- {
- }
- public int compareTo(customer c)
- {
- return 0;
- }
- public String toString()
- {
- return"";
- }
- }
- import java.util.PriorityQueue;
- public class lunchLine {
- private PriorityQueue<customer> lunch;
- public lunchLine(){
- lunch=new PriorityQueue<customer>();
- }
- public void add(customer c)
- {
- }
- public customer remove()
- {
- }
- public String showLine()
- {
- //shows the whole lunch line without removing it
- }
- }
- }
- public class lunchLineRunner {
- public static void main ( String[] args )
- {
- lunchLine line=new lunchLine();
- //add test cases and test your methods
- }
- STACK LAB/DATA FILES
- Advanced Computer Science
- Lab Goal : The lab was designed to teach you more about Stacks
- 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!
- Sample Output:
- Teacher Roster:: Medlin
- Teacher Roster:: Bungert
- Reinartz
- Fendrich
- Bender
- Brooks
- Medlin
- Teacher Roster:: Wu
- Bungert
- Reinartz
- Fendrich
- Bender
- Brooks
- Medlin
- Teacher Roster: Bungert
- Reinartz
- Fendrich
- Bender
- Brooks
- Medlin
- Teacher Roster:: Early
- Bungert
- Reinartz
- Fendrich
- Bender
- Brooks
- Medlin
- Teacher Roster:: Graham
- Johnson
- Young
- Jones
- Smith
- Bungert
- Reinartz
- Fendrich
- Bender
- Brooks
- Medlin
- Teacher Roster:: Jones
- Smith
- Bungert
- Reinartz
- Fendrich
- Bender
- Brooks
- Medlin
- package CompSciFinal;
- import java.util.Stack;
- public class teacherDump {
- public teacherDump()
- {
- }
- public void hire(String t)
- {
- //hire a new teacher
- }
- public String fire()
- {
- //fire a teacher
- }
- public String showListOfTeachers()
- {
- return "";
- }
- }
- package CompSciFinal;
- public class teacherDumpRunner {
- public static void main ( String[] args )
- {
- teacherDump teach=new teacherDump();
- teach.hire("Medlin");
- System.out.println(teach.showListOfTeachers());
- teach.hire("Brooks");
- teach.hire("Bender");
- teach.hire("Fendrich");
- teach.hire("Reinartz");
- teach.hire("Bungert");
- System.out.println(teach.showListOfTeachers());
- teach.hire("Wu");
- System.out.println(teach.showListOfTeachers());
- teach.fire();
- System.out.println(teach.showListOfTeachers());
- teach.hire("Early");
- System.out.println(teach.showListOfTeachers());
- teach.fire();
- teach.hire("Smith");
- teach.hire("Jones");
- teach.hire("Young");
- teach.hire("Johnson");
- teach.hire("Graham");
- System.out.println(teach.showListOfTeachers());
- teach.fire();
- teach.fire();
- teach.fire();
- System.out.println(teach.showListOfTeachers());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement