Question: CS 212- Lab 2 Create a Java project with the classes specified in Inheritance & Polymorphism.pdf. Create an interface called Comparable with a method called

 CS 212- Lab 2 Create a Java project with the classes

CS 212- Lab 2 Create a Java project with the classes specified in Inheritance & Polymorphism.pdf. Create an interface called Comparable with a method called compareTo. The Employee class should implement this interface public interface Comparable f int compareTo(Object o); In the Staff and Faculty classes, implement the compareTo method from the ble interface. The compareTo method compares this Object with another bject. It returns a negative integer, zero, or a positive integer if this Object is less than, equal to, or greater than, the other Object. Compare the pay between each Object. The argument passed in can be either a Staff object OR a Faculty object. Thus, make sure that it is possible to compare a Staff object to a Faculty object by pay What happens if you implement the compareTo method in the Employee class rather than the Staff and Faculty classes? Modify the email method in the Person class as follows: Create an email address with the person's first initial and last name followed by @qc.cuny.edu Example: JDoe@qc.cuny.edu DO NOT MODIFY any other code than the email() method in the Person class. There is no need to add instance variables and change the constructor. Hint: Use the split() method to split a string into substrings. Use the charAtfint index) method to retrieve the first character of the first name. Add the missing accessor and mutator methods to the classes. In the InheritanceApp, make sure the correct information for each employee is displayed. Compare Mary Smith to Dave Watson; the result should show the employee with the higher pay CS 212- Lab 2 Create a Java project with the classes specified in Inheritance & Polymorphism.pdf. Create an interface called Comparable with a method called compareTo. The Employee class should implement this interface public interface Comparable f int compareTo(Object o); In the Staff and Faculty classes, implement the compareTo method from the ble interface. The compareTo method compares this Object with another bject. It returns a negative integer, zero, or a positive integer if this Object is less than, equal to, or greater than, the other Object. Compare the pay between each Object. The argument passed in can be either a Staff object OR a Faculty object. Thus, make sure that it is possible to compare a Staff object to a Faculty object by pay What happens if you implement the compareTo method in the Employee class rather than the Staff and Faculty classes? Modify the email method in the Person class as follows: Create an email address with the person's first initial and last name followed by @qc.cuny.edu Example: JDoe@qc.cuny.edu DO NOT MODIFY any other code than the email() method in the Person class. There is no need to add instance variables and change the constructor. Hint: Use the split() method to split a string into substrings. Use the charAtfint index) method to retrieve the first character of the first name. Add the missing accessor and mutator methods to the classes. In the InheritanceApp, make sure the correct information for each employee is displayed. Compare Mary Smith to Dave Watson; the result should show the employee with the higher pay

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!