Question
Write a program that includes an empPay class that can be used to calculate and print the take-home pay for a restaurant employee, and an
Write a program that includes an empPay class that can be used to calculate and print the take-home pay for a restaurant employee, and an Employee class that will contain your main method and be used to test it. When you create this project, name it empPayXX, where XX = your initials. For example, empPayMR.
An employee has 2 attributes (fields): name (String) grossPay (double) Take-home pay is calculated by taking the grossPay and subtracting the following taxes: Federal Tax rate: 18%, Retirement: 10%, Social Security Tax: 6%. (all values subtracted should use original grossPay as the base value and of course, they're all double data types).
create the following in your class file: Private fields for the name and grossPay. Private FINAL (constant) fields for each of the federal, pension, and social security rates. So five fields in total. Create public accessors/mutators for your name and grossPay attributes. These could be called from anywhere in the program. Then create one showDeductions method to print all of the pay and deduction information
Create three PRIVATE HELPER METHODS to calculate the federal, retirement, and social security deductions. These will only be called from within your class file. So you should have 8 member methods total in your class file, five of them public and three of them private for calculating deductions. Investigate importing java.text.NumberFormat in your class file to properly format your output. This will require you to lookup NumberFormat and it's proper use for currency. In the working world, you will need to commonly do this. Or, you can format your currency output the best you know how. Create a second class called Employees to test this restaurant empPay class and it's members within a main() function. Test with three employees.
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