Question
JAVA You have been hired by up and coming company Gekko & Co. to create a pay stub calculator for their employees. Their employees are
JAVA
You have been hired by up and coming company Gekko & Co. to create a pay stub calculator for their employees. Their employees are paid only once per month. The pay stub will show take-home pay for each pay period after withholdings for taxes and retirement fund.
Gekko would like your program to read the following input for an employee:
Employee name,
Month and year the employee was hired.
Hours worked in the pay period (between 0 and 350),
Job title, and
Hourly pay rate.
After reading in these values, your program must perform two kinds of calculation:
Number of vacation hours earned. Vacation calculations are based on the number of months worked. and
Net wages to be paid. Gekko employees are required to contribute a portion of their pay to their retirement fund each pay period. This retirement fund withholding is taken pre-tax. Tax withholding will then be calculated.
Data Members (Fields)
Name, anniversary month, anniversary year, hours worked, job title, hourly pay rate, number of months worked, vacation hours, gross pay, retirement withholding, tax withholding, net pay.
Two Constructors
PayStub() : Default constructor to initialize the data members.
PayStub( String name, int anniversaryMonth, int anniversaryYear, int hours, String title, double payRate ) : Parameterized constructor to initialize the data members.
Member Methods
String getName() : Returns the name of the employee
int getMonth() : Returns the anniversary month of the employee
int getYear() : Returns the anniversary year of the employee
int getHours() : Returns the number of hours worked by the employee
String getTitle() : Returns the job title of the employee
double getPayRate() : Returns the hourly pay rate of the employee
int numMonthsWorked(): Calculate and return the number of months worked based on the anniversary month and year and the current pay period month and year. Note: The current pay month = 1, current pay year = 2019.
double vacationHours() : Calculate the vacation hours earned this pay period as the number of months worked times the vacation rate of 8.25 vacation hours per month. Vacation hours are reported to two significant digits. For example, 0.12 or 12.79.
double grossPay() : Calculate gross pay, defined as the hours worked times pay rate.
double retHold() : Calculate the retirement withholding for the employee, which is defined as the gross pay times the retirement rate of 5.2%.
double tax() : Calculate and return the tax withholding for the employee, which is defined as the taxable income (gross pay minus retirement withholding) times the tax rate of 28.0%.
double netPay() : Calculate the net pay which is gross pay minus retirement minus tax withholdings.
void drawLogo() : Print the company logo
Gekko & Co. "$" ~~~ / \ `. / \ / /_ _ _ \/ |
void printInfo() : Print the details of the employee including the gross pay, taxes and net pay. BIG HINT: to match the output in Gradescope for printing gross pay, retirement, tax, and net pay use the following format string with the printf method "%7.2f ". Otherwise you may have trouble having the spacing match up correctly in output.
Input
Your program's main method will need to read and store employee information while displaying the prompts exactly as shown in the following example:
Enter your Fullname: Karin Nadya Enter your Anniversary Month(1-12): 4 Enter your Anniversary Year: 2015 Enter your hours worked this pay period(0-350): 170 Enter your Job Title: Computer System Analyst Enter your pay rate: 42.12 |
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