We are going to spruce up our Week01 assignment to use abstract and interface.

Be sure to implement all methods exactly as specified, because I may hook your classes up to my own tester program!

“Person” never actually got used as an object – it was just extended. First, we’ll turn “Person” into an abstract class.

Every class that extends “Person” will need an ID, so “Person” will define abstract get and set for ID.

Re-write Customer and Employee to provide the getID() method and setID(int ID) methods.

Not only do Customer and Employee extend Person, they also implement a couple of interfaces:

  • Mailable, which requires a method named getMailingAddress(), that returns a string suitable for mailing labels.
  • Comparable, which requires a method named equals and a method int compareTo(Object other) which returns a negative number if the ‘other’ is less than this, a zero if it is equal to, and a positive number if ‘other’ is greater than the current ‘this’. Use IDs to compare.

You will have these classes, each in its own file:

  • Person.java
  • Mailable.java
  • Comparable .java
  • Customer.java
  • Employee.java
  • Week02.java

Every .java file should have as its first line a comment with your name in it.

When your program runs, your name should appear in the title bar of the window.

Submit each file separately in the dropbox. If you use more classes, they should be implemented as inner classes, so that you have only these four files to submit.

If you are claiming extra credit, put a file named “extracredit.txt” in the drop box, explaining why you think you deserve extra credit.

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.