Question
OBJECTIVES(Answer require in java) To apply knowledge of the Comparable interface to a problem To understand and override the toString and equals methods INSTRUCTIONS For
OBJECTIVES(Answer require in java)
To apply knowledge of the Comparable interface to a problem
To understand and override the toString and equals methods
INSTRUCTIONS For this assignment, you will create an Employee class. To maintain consistency for my grading, please place your Employee and EmployeeDemo classes (.java files) in a package called proj1 That means dont call your package p1, Proj1, MyProject, Prog1, Snuggles, Dumptruck, buffalo, or myEmployeesAreAwesome. Call the package proj1. The class will contain the following fields: degree o The classification of the employee o Valid values are based on an enumerated type, DegreeType: None Associate Bachelors Masters Doctorate firstName o The given name of the employee o E.g., Amanda lastName o The family name of the employee o E.g., Hugginkiss experience o An integer representing the number of years the employee has been with the company The class will contain the following methods: Employee( ) o Constructor initializes the fields to their default values degree set to None firstName set to Stan lastName set to Dupp experience set to 0 Employee(degree, firstName, lastName, experience) o Constructor initialize the fields to the values passed in by the client Getter and setter methods for each of the field names toString( ) o overridden from the Object class o This method should return a string containing a reference to the value in the following format: firstName lastName has been with the company for experience years and has a degree level of degree o An actual example might be: Hedda Hare has been with the company for 5 years and has a degree level of Bachelors or Jerry Attrick has been with the company for 30 years and has a degree level of Masters equals( ) o overridden from the Object class o An employee is equal to another employee if their valuePoints are equal: o valuePoints = experience * degreeValue, where degreeValue is 1,2,3,4, or 5 based on degrees None, Assciate, Bachelors, Masters, or Doctorate, respectively) compareTo(Employee otherEmployee) o implemented from the interface Comparable o Specifically, Comparable should be used for the interface o The method returns the following: -1 is the current ship objects valuePoints is less than otherEmployees valuePoints 0 if the employees have equal valuePoints 1 if the current ship objects valuePoints is greater than otherEmployees valuePoints o The degree point values toward the valuePoints calculation (valuePoints = experience * degreeValue): None is worth 1 Associate is worth 2 Bachelors is worth 3 Masters is worth 4 Doctorate is worth 5 o In other words, a person working 5 years with a bachelors degree (5 * 2 = 10) is worth the same as a person with a Doctorate working 2 years (2 * 5 = 10)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started