Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Beginner Java here. How would I code this? Please leave comments. And use the standard Validation class isWithinRange, isDouble, isWithinRangeDouble etc.. Thank you for your
Beginner Java here. How would I code this? Please leave comments.
Create an abstract Employee business class with these private instance variables: Employee number: Last name: First name: Email address: 1000-9999 numeric present present present Include two constructors, an empty constructor, and one that accepts all parameters, and a get and a set method for each of the instance variables. Include in this abstract class an abstract method called calcPay. The abstract method should accept a double parameter and return a double. You will also need to override the toString) method that will displays all the above fields in a formatted version (make it look nice). Create two subclasses that extend Employee, one for hourly employee, and one for salary employee. Both subclasses should override the abstract method in Employee. Hourly subclass: The hourly subclass should contain an instance variable for number of hours worked, two constructors that call the super class, and a get and set method for the instance variable. Hourly rate should be a constant that cannot be changed and set at 15.75. The calcPay method should accept the number of hours worked as the parameter, and calculate an hourly employee's pay by multiplying the number of hours worked by the hourly rate. Salary subclass: The salary subclass should contain an instance variable for yearly salary, two constructors that call the super class, and a get and set method for that instance variable. The calcPay method should accept a yearly salary as the parameter, and calculate a monthly salary by dividing the yearly salary by twelve months. The presentation class should ask for the employee number, last name, first name, email address and social security number. The presentation class's main method should consist almost entirely of method calls. Error checking should be done on all user-entered fields using a Validation class. Once the fields have been validated, those values should be passed to business class using the set methods. The application class should also ask if the employee is hourly or salary. Based on that answer; determine which calcPay method to call in order to calculate pay. If the employee is hourly, the application should prompt the user for the number of hours worked. That value should And use the standard Validation class isWithinRange, isDouble, isWithinRangeDouble etc..
Thank you for your help
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