Office Depo, an office supply retailing company, donates its surpluses to colleges at the end of each year. Volunteers will help deliver packages of supplies to representative of colleges (Recipient of supplies). Write an application to simulate delivering packages from the container of packages by the volunteers to recipients.
Generic Queue
Generic Stack
Exception handling
Volunteer - Holds the relevant information for a Volunteer: name
DonationPackage - Holds the information of the package to be donated: description, weight
Recipient - Holds the information of the recipients: name
1.Create a generic queue class called MyQueue that implements the QueueInterface given you.
2.Create a generic stack class called MyStack that implements the Stack Interface given you.
3.Create a class VolunteerLine that implements VolunteerLineInterface. This class contains a queue of Volunteers and simulates queuing and dequeuing volunteers to and from the volunteers' line.
4.Create a class RecipientLine that implements RecipientLineInterface . This class contains a queue of Recipients and simulates queuing and dequeuing Recipients to and from the recipients' line.
5.Create a class Container that implements ContainerInterface. This class contains a stack of DonationPackage and simulates adding and removing package from the container's stack.
When a volunteer enters a queue he/she will stay in the queue and every time that the volunteer is removed from the line he/she will be go back to the end of the line.
The DonationManager class will manage adding a new package to the container, a new volunteer to the volunteer queue line , a new recipient to the recipient queue and donating package by the volunteer to the recipient. DonationManager will implement the interface DonationManager Interface.
1.RecipientException:
public class RecipientException extends Exception {
public RecipientException(){};
RecipientException(String message) {
super(message);
}
If the user attempts to add new Recipient and the recipient line is full, throw RecipientException("Recipient Queue is full"). If user attempts to remove a recipient and the recipient is empty, throw RecipientExcpetion(Recipient Queue is empty);
2.VolunteerException - similar to RecipientException except throws VolunteerException when the Volunteer Queue is full or empty
3.ContainerException - similar to RecipientException except throws ContainerException when the Volunteer Stack is full or empty
You may add additional methods and attributes to your classes.
GUI Driver - provided for you
1.Initially there is no package on the container stack, or any volunteers and recipients on the queue.
2.Allows the user to load new packages to the container and add new volunteers to volunteer's line and new recipient to recipients line.
3.Allows the user to simulate the process of donating a package from the container by the volunteer on the front of the Volunteer queue to the recipient on the front of the Recipient queue. When a volunteer finishes donating the package to the recipient, he/she will be placed at the back of the queue of volunteers to continue the process of donation. Each volunteer takes one package at a time to deliver to the recipient.
At startup: see image.
After selecting "Stack New Package" Pen(first) and Books (second). see image.
After adding new Volunteers John (first), Nicole (second): see image.
After adding new Recipient MC, Maryland see image.
After selecting Donate Package First Time: see image.
After selecting Donate Package Second time: see image.
After selecting Donate Package Third time see image.
If the user tries to add a new volunteer and The line of volunteers is full: see image.