Question: write a employee class For Employee.java 1. 2. Define an Employee's 3 attributes: id, name, salary Define a static int employeeCount inititally set to 0
write a employee class

For Employee.java 1. 2. Define an Employee's 3 attributes: id, name, salary Define a static int employeeCount inititally set to 0 Increment this variable whenever a new Employee object is created a. i. (Hint: in all of your constructors!) 3. Write accessors for: name, salary, id, and employeeCount 4. 5. a. I should be able to call getEmployeeCount() with the class name (not objects!) Write mutator methods name and salary Write a print method that prints an employee object's information as follows: Employee ID: 5 Name: Alice Salary: $50000.0 //Note the $,:, and spacing 6. Define at least two constructors for the Employee class One constructor must be the default constructor (no parameters) In each constructor, initialize salary and name to some default values or the values passed in if you have parameters In each constructor, be sure to increment the employee count and set that Employee object's id number to the current count Example code to test with a. b. c. d. Employee e1-new Employee( Employee e2 new Employee( System.out.println(e1.getld(): //prints 0 System.out.println(e2.getld())://prints1 System.out.println(Employee.getEmployeeCount()); //prints 2 Write an equals method that determines if two Employee objects have the same values for all three attributes. Example code to test with 7. Employee e1 new Employee(810, "Alice", 5); Employee e2 new Employee(810, "Alice", 5); //your constructor may be different System.out.println(e1.equals(e2)); //prints true
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
