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.

Concepts tested:

Generic Queue
Generic Stack
Exception handling

Data Elements

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

Data Structures

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.

Assumptions

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.

Data Manager

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.

Exception Classes

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.

Examples:

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.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.