Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 4A : Payroll Calculator program u sing a dowhile loop , if statements and constants Description: In this project you will develop a Java

Assignment 4A: Payroll Calculator program using a dowhile loop, if statements and constants

Description: In this project you will develop a Java application that will calculate a weekly paycheck based on the type of job. You should use a dowhile loop to check whether to quit or continue calculating weekly paychecks and while loops for input validation. The user should be able to calculate as many weekly paychecks as they want (use a sentinel). Use if statements to choose the correct paycheck calculation for the type of employee. All numbers in your code must be represented with constants. You should only use Java code that we have covered up to this point.

Requirements:

Prompt the user to enter whether the employee is salaried, hourly, or commission. Use numbers to indicate their pay type (Enter a 1 for salaried, a 2 for hourly, or a 3 for commission, and a 4 to quit) using a dowhile loop
Check to make sure that the user enters a 1-4 before proceeding using a while loop (input validation)
Use if statements to execute the correct code for each salary type
Declare constants for all numbers except the numbers the user inputs
Use doubles formatted to 2 decimal places when printing numbers that represent money
Upload the pseudocode for the entire program

If salaried:

Prompt the user to enter their first and last name
Prompt the user to enter their yearly salary amount and thecompanys annual profit bonus percent (based on last years sales which they will distribute in this years paychecks) in decimal (i.e. if the profit bonus percent is 5%, the user should enter .05)
Calculate the weekly paycheck - multiply the yearly salary by the profit bonus plus 1 (If profit bonus is .05, multiple yearly salary by 1.05) and divide it by 52 (52 weeks in a year)
Print out the employees name, total yearly salary includingprofit bonus and this week's paycheck amount including bonus with all dollar amounts displayed to 2 decimal point accuracy

If hourly:

Prompt the user to enter their first and last name
Prompt the user for the hourly rate of pay, the total number of hours worked this week (If they work 50 hours, they type in 50 hours, not 40, then 10 overtime)
If the user works 40 hours or less, calculate the weekly paycheck by multiplying the number of hours worked by the hourly rate of pay
If the user works more than 40 hours in a week, 40 hours gets paid at the hourly rate the user input and the overtime hours get paid at 1.5 times the hourly rate of pay
o This part is more complicated because you need to test whether the hours worked is greater than 40 and if so you must pay time and a half for hours worked over 40 and the hourly rate for 40 hours
Calculate the weekly paycheck amount (regular pay plus overtime)
Print out the employees name, the regular pay amount, the overtime dollar amount, and this weeks total paycheck amount with all dollar amounts displayed to 2 decimal point accuracy

If Commission:

Prompt the user to enter their first and last name
Prompt the user to enter the number of items sold this week as type int and the cost per item as a type double (assume they only sell one type of thing, ex: I sold 7 hammers at $12.00 each)
All commissioned employees receive a base pay per week of $200 plus 10% commission
o Commission is .10 multiplied by the total dollar amount of the items sold
Print out the employees name, the total amount for the items sold, the commission amount, and this week's total paycheck amount with all dollar amounts displayed to 2 decimal point accuracy
it should be based on java language

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Is there a clear hierarchy of points in my outline?

Answered: 1 week ago