Genuine, simple and ORIGINAL code1. Specification
Genuine, simple and ORIGINAL code<br/><br/><br/>1. Specification<br/>I
am in need of a program that computes the salaries for a collection of employees of different types. This program consists of four classes.
1. The first class is Employee, which contains the employee’s name and monthly salary which is specified in whole dollars. It should have three methods:
a. A constructor that allows the name and monthly salary to be initialized.
b. A method named annualSalary that returns the salary for a whole year.
c. A toString method that returns a string containing the name and monthly salary, appropriately labeled.
The Employee class has two subclasses: Salesman and Executive.
2. The Salesman class has an additional instance variable that contains the number of sold items. It should have the same three methods:
a. A constructor that allows the name, monthly salary and number of sold items to be initialized.
b. An overridden method annualSalary that returns the salary for a whole year. The salary for a salesman consists of the base salary computed from the monthly salary plus a commission. The commission is zero if the number of sold items is less than 200, equal to one month salary if the number of sold items is between 200 and 300 and equal to two month salary if the number of sold items is 300 or more.
c. An overridden toString method that returns a string containing the name, monthly salary and number of sold items, appropriately labeled.
3. The Executive class has an additional instance variable that reflects the current stock price. It should have the same three methods:
a. A constructor that allows the name, monthly salary and stock price to be initialized.
b. An overridden method annualSalary that returns the salary for a whole year. The salary for an executive consists of the base salary computed from the monthly salary plus a bonus. The bonus is $20,000 if the current stock price is greater than $100 and nothing otherwise.
c. An overridden toString method that returns a string containing the name, monthly salary and stock price, appropriately labeled.
4. Finally there should be a fourth class P1Driver that contains the main method. It should read in employee information from a text file inputData.txt. The file will contain employee information for only two years: 2015 and 2016. Each line of the text file will represent the information for one employee for one year. An example of how the text file will look is shown below:
2015 Employee Smithson,John 2000
2016 Salesman Jokey,Will 3000 236
2015 Executive Obama,Barack 5000 150
****Enough employees for the test cases******* the 3 provided are just an example
The year is the first data element on the line. Next is the type of the employee followed by the employee name and the monthly salary. For salesmen, the final value is the number of sold items and for executives the stock price. As the employees are read in, Employee objects of the appropriate type should be created and stored in an array depending upon the year. There should be two arrays, one corresponding to 2015 and one corresponding to year 2016. You may assume that the file will contain no more than 200 employee records for each year and that the data in the file will be formatted correctly.
Once all the employee data is read in, a report should be displayed on the console for each of the two years.
Each line of the report should contain all original data supplied for each employee together with that employee’s annual salary for the year. The last line of the report should display the total number of employees and the average of all salaries for that year.
*****The program should compile without errors*****
In addition the following design constraints should be followed:
Declare all instance variables private
Avoid the duplication of code
Test cases should be supplied in the form of a table with columns indicating what aspect is tested, the input values, expected output, actual output and if the test case passed or failed. This table should contain 5 columns with appropriate labels and a row for each test case. Note that the actual output should be the actual results you receive when running your program and applying the input for the test record. Be sure to select enough different kinds of employees and situations to completely test the program.