Reference no: EM131885
Create a base Employee class and a derived StudentEmployee class. Below is the basic UML structure of both classes.
Implementation
This section further explain each class method found within the UML diagram.
Class Employee
- get/setName gets and sets the employee's private name variable. Be sure to filter out bad input, such as empty strings.
- get/setEmployeeId gets and sets the employee's ID number. Be sure to filter out ID numbers that are less than or equal to zero.
- set/isWorking sets and gets whether or not the employee is working. No filtering is required.
- toString returns a tab-delimited string in the following format: "name \t id \t is working"
Class StudentEmployee
- get/setPayRate gets and sets the employee's pay rate. Be sure to filter out negative values.
- get/setHoursWorked gets and sets the hours worked for the current week. Be sure to filter out negative values.
- getWeeklyPay computes the student's weekly pay. To calculate, multiply the number of hours worked times the pay rate.
- set/isWorkStudy sets and gets whether the student is work study.
- toString() returns a tab-delimited string in the following format: "name \t id \t is working \t hours worked \t is work study \t pay rate"
Testing Our Classes
Use your main function to test the StudentEmployee class. In main, prompt the user for a CSV (comma separated value) file to open. Then, using the provided StringSplitter class, split the CSV using the comma as a delimiter and use the data to create a new StudentEmployee.