Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this Assignment, you will implement a Java class, called 'Employee', which can be used to represent employee objects in an application to be used,
In this Assignment, you will implement a Java class, called 'Employee', which can be used to represent employee objects in an application to be used, for example, in an HR application. You will then test your class by implementing another class, called 'EmployeeDriver'. To start, Open Eclipse and create a new project and name it 'HRApplication' then follow the following steps: Create a class called 'Employee' inside the 'HRApplication ' project. 1. Declare the following instance variables in 'Employee'. Remember that instance variables must be declared as private. a. name (of type String). b. hourlyRate (of type double). c. hours (of type int). 2. Declare the following variable to be a Constant. a. TAX (of type double). Tax rate (between 0 and 1.0) Part 2. Constructor and Getters/Setters 1. Declare a constructor for the 'Employee' class that takes three input parameters and use the input parameters to initialize the instance variables. 2. Create getters and setters for each instance variable. 3. Implement a 'toString' method to print the employees' information if one doesn't exist. 1. Go to the driver class, inside the main method, declare a variable of type 'Employee' and call it 'myEmployee'. 2. Using a sentinel loop, prompt the user for a name, a rate and hour(s) worked. Use the inputs to instantiate an employee object and to initialize the instance variables. Choose any values. (Note: you have to use new keyword to instantiate variables in the employee class. 3. Inside the while loop check if the inputs, rate and hours are invalid; less than 0. Display an error message to the user if the values are invalid. Then prompt the user if they would like to continue or not. 4. Call the 'toString' method from 'EmployeeDriver' to print the employees' information. 5. Test different inputs values to verify the code works as expected and that it executes error free Part 4. Methods - Do not start until after Feb. 1 st lecture 1. Create a method with a return type double to calculate and display the amount each employee will be paid before taxes. 2. Create a method with a return type double to calculate and display the amount each employee will be taxed 3. Create a method with a return type double to calculate and display the amount each Part 4. Methods - Do not start until after Feb. 1st lecture 1. Create a method with a return type double to calculate and display the amount each employee will be paid before taxes. 2. Create a method with a return type double to calculate and display the amount each employee will be taxed 3. Create a method with a return type double to calculate and display the amount each employee will be paid after taxes have been withheld 4. Create a method with a return type double to calculate and display the total amount of taxes the company will withhold 5. Call/Invoke each method from the Driver class on the employee object and display the results
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