You are tasked with writing some code that will be part of a system managing package lockers
Question:
You are tasked with writing some code that will be part of a system managing package lockers (similar to Amazon Hub lockers). Your code will need to represent mail items, lockers, and recipients (the person the mail is addressed to).
A recipient has:
● A first name
● A last name
● An email address. You do not need to validate the format of an email address for this
assignment.
A mail item has:
● A width in inches, an integer greater than or equal to 1.5.
● A height in inches, an integer greater than or equal to 2.
● A depth in inches, an integer greater than or equal to 1.
● A recipient.
A locker has:
● A maximum width in inches, an integer greater than or equal to 10.
● A maximum height in inches, an integer greater than or equal to 20.
● A maximum depth in inches, an integer greater than or equal to 15.
● A mail item—the item stored in the locker, if any. If there is no mail in the locker, this field
should be set to null. You can assume that when a locker is first created, it is empty.
1. Write classes to represent a recipient, a mail item, and a locker as described above.
2. Write void method, addMail, that consumes a mail item and stores it in a locker with two exceptions: if the locker is occupied (it already contains a mail item) or the mail item exceeds the dimensions of the locker (any single dimension of the mail item is bigger than the locker), the mail item should not be added to the locker.
3. Write method, pickupMail, that takes one parameter, a recipient. This method will remove and return the mail item from the locker under the following conditions: there is a
mail item in the locker AND the recipient passed to pickupMail matches the recipient of the mail item.
4. Generate a UML diagram and write unit tests.
Horngrens Accounting
ISBN: 978-0133855388
10th Canadian edition Volume 2
Authors: Tracie L. Miller Nobles, Brenda L. Mattison, Ella Mae Matsumura, Carol A. Meissner, Jo Ann L. Johnston, Peter R. Norwood