Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A. Create two classes according to the given UML diagram: Employee -name: String -heirDate: Date -salary: double +Employee(String, Date, double) +getName(): String +getHeirDate(): Date +getSalary():
A. Create two classes according to the given UML diagram: Employee -name: String -heirDate: Date -salary: double +Employee(String, Date, double) +getName(): String +getHeirDate(): Date +getSalary(): double +setName(String): void +setHeirDate(Date): void +setSalary(double): void Date -day: int -month: int -year: int +Date(int, int, int) + getDay(): int +get Month(): int +getYear(): int +setDay(int): void +setMonth(int): void +set Year(int): void 1. Implement the two classes given in the UML diagram. (Do not use the Date class in Java). 2. Add a static member: numOfEmployees to the class Employee to keep track of the number of Employees created and increment it in each constructor of the class Employee. 3. Add a copy constructor to the Employee class. 4. Add a toString() method to each class. 5. Complete the Employee class by adding the method increase Salary() that increases the salary of an Employee by an amount x. 6. Complete the Employee Class by adding a method isHeiredBefore() to check if a heir date is before a given date or not. The method should return True if the heir date is before the given date, False, if the heir date is on or after the given date. 7. Create a java main class, call it "TestEmployees". In the main method, do the following: a) Create an employee el, with the name = "Ali", heir date = 24-2-2020, and salary = 85,000 b) Create another employee e2 using the copy constructor. Use el for the copy. c) Create three more employees, say e3, c4, and e5. Give them different attributes. d) Display the number of employees created using the static member numOfEmployees. e) Change the name of one employee, say e3 f) Change the salary of another employee, say e4 g) Change the heir date of another employee, say e5 h) Check if the employee's (el) heir date is before 30-12-2019. If this is true, increase his salary by 8000, else increase his salary by 6000. i) Display all employees again after the changes you made
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