Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in java 1. Implement class Employee that has the following members: a. Five attributes representing: employee Name of type string, employee ID of type string,
in java
1. Implement class Employee that has the following members: a. Five attributes representing: employee Name of type string, employee ID of type string, basicSalary of type double, maritalStatus of type character ('S' if Single or 'M' if mar- ried), and numberOfChildren of type integer (zero if the employee has no children). b. A default constructor which initializes employee Name to "AAA", employeeld to "AA-11", basicSalary and numberOfChildren to 0, and maritalStatus to 'S! C. A constructor which initializes the five data members to given initial values given as parameters to the constructor. Note that, the employee Name should never include a digit if the parameter has a digit, then assign the string "AAA" to it. Also, the employ. eeld should have the format of two uppercase letter followed by dash "." followed by two digits such as "ER-12", if the parameter doesn't have this format, then assign the string "AA-00". The basic salary can not be less than 0, and so is the number of children. Finally, the marital status should be either 'S' or 'M', if the parameter is anything else, assign the value 'S' to it. d. Set and Get methods for each attribute. When implementing the set methods, follow the exact same value validation rules as described in the previous point. e. A method named calculate TotalSalary(). The method calculates and returns the total salary of an employee where the total salary is the summation of the employee's basic salary and his/her social allowance. The social allowance is as follows: i. 100 KD for the employee, ii. 50 KD for the spouse (wife/husband), iii. 15.5 KD for each child In addition to the above, the total salary will be deducted by 3% as a tax. f. A method named toString() that returns a string of all the information of the employee in a neat and organized format. 2. Implement a tester class that includes the main method. In the method, the following should be performed: a. Reads the full information (employeeName, employeeld, basicSalary, maritalStatus, and numberOfChildren) from a text file named "info.txt" for 10 employees and stores the information in an array of 10 objects of class Employee. b. Calculates and displays the total salary for each of the 10 employees. c. Displays the information of each employeeStep 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