5/5 – (1 vote)
Part 1:
Inside a project named <lastname2a (for example, avitabile2a), do the following:
Create an abstract class called Customer. This class should have properties of name and email, a constructor that assigns values to name and email, a getName() method, a getEmail() method, and an abstract method named customerInfo(). Create two classes named BusinessCustomer and HomeCustomer that contain constructors and also contain a customerInfo() method. The customerInfo() method should output the name, the email, and the kind of user.
Write a program named <lastname2a.java (for example, avitabile2a.java) that creates a TreeSet; adds BusinessCustomers and HomeCustomers to it, and outputs the values sorted by the emails.
Make sure that your Customerr class implements the Comparable interface and includes whatever methods you need to make that work..
Part 2:
Inside a project named <lastname2b (for example, avitabile2b), do the following:
Create an interface called Customer. This interface should contain getName(), getEmail(), and customerInfo().
Create two classes named BusinessCustomer and HomeCustomer that implement this interface.
Write a program named <lastname2b.java (for example, avitabile2b.java)that creates a TreeSet; adds BusinessCustomers to it, and outputs the values sorted by the emails of the BusinessCustomers.
Your User interface also contains the compareTo method.
Your BusinessCustomer and HomeCustomer classes also implement the Comparable interface.
Reviews
There are no reviews yet.