Project 2
A printer manager program is to manage 10 printers (maximum) available in a local area network. Printer manager receives jobs from the student users. It processes a printing job by sending it to the printer that has smallest number of jobs waiting. Each printer selects print jobs to print in the following order: 1 to 2 page jobs are printed first, 3 to 5 page jobs next, any other sized job according to the time of arrival. Each student is allowed to print a maximum of 100 pages per semester. The printer manager must keep a record of this, and prevents a student who has exceeded his quota, from printing. The printer manager should also enable addition or removal of a printer; removal only if it does not have a print job waiting to be printed.
a. Give a graphical representation of the ADT.
b. Give the specification of various operations/methods of the ADT PrinterManager. The ADT should have at least the following three methods: processJob � to process a print job sent by a student for printing; addPrinter � insert or activate a new printer in the network; and removePrinter � to remove or deactivate a printer in the network. Other than these you will have to specify other supporting methods.
c. Implement the specification as a Java class.
d. Test your PrinterManager implementation by using it in the Main class where static main method reads print requests, requests to add and remove printers from a text file and calls appropriate PrinterManager methods. Assume initially there are 3 printers (ids: 1, 2, 4) active and there are 20 students registered (ids from 1 to 20). After reading the requests from the file and dispatching jobs to printers, the main method should access, each printer through a PrinterManager method, and output the details of the print jobs dispatched to it. It should also print the ids of the students who used their quota.
Please turn over�.
Test Data:
Student 2: print 20 pages
Student 11: print 50 pages
Student 12: print 30 pages
Student 1: print 2 pages
Student 11: print 40 pages
Student 1: print 1 page
Student 2: print 30 pages
Remove printer #2
Student 11: print 20 pages
Student 3: print 2 pages
Student 12: print 70 pages
Student 2: print 20 pages
Add printer #7
Student 6: print 4 pages
Student 7: print 14 pages
The output format:
Printer #1: Print job: Student Id 1: 2 pages
Print job: Student Id 2: 20 pages
�
Printer #2: Print job: Student Id 11: 50 pages
�
i don't want to answer this project , i want only guideline how can i connect student object with printer queue ,
i think maybe in HashMap but the doctor sayed no use for Maps only queues and PriorityQueue , i have try but i stop because i don't know how to link
printer and its jop , like this :
Printer #2: Print job: Student Id 11: 50 pages
i used Comporator in PQueue but it doesn't work , is there any GUIDE LINES for this problem ?