Write a program that calculates and prints the monthly pay check for an employee. The net pay is calculated after taking the following deductions:
Federal Income Tax: 15%
State Tax: 3.5%
Social Security Tax: 5.75%
Medicare/Medicaid Tax: 2.75%
Pension Plan: 5%
Health Insurance: $75.00
Your program should prompt the user to input the employee name and the gross amount. The out put will be stored in a file. Format your output to two decimal places. A sample output follows.
Gross Amount: $3575.00
Federal Tax: $536.25
State Tax: $125.13
Social Security Tax: $205.56
Medicare/Medicaid Tax: $98.31
Pension Plan: $178.75
Health Insurance: $75.00
Net Pay: $2356.00
Originally posted by Coleman Fredericks:
I am a beginner programmer and found this fairly easy program but im so new to java that i cant figure the coding out. If anybody could help this would be awesome! I would even pay someone to code this for me and put it into file. Thanks, cole.
If this is a program you found (presumably while you were looking for something easy to program to teach yourself Java), why do you want someone else to code it for you ? You won't learn anything that way.
Of course, if this is homework and you are trying to cheat, then nobody is going to do this for you.
If you are genuinely trying to learn, then read thru the Java Tutorial and then have a go at coding the program. When you get stuck, post your code here, say what the problem is and people will point you in the right direction.
1) think about it a LOT before you write any code.
2) break the task into many sub-problems.
3) write code for 1 sub-problem, TEST TEST TEST, and then make sure it works how you want it to by TESTING it.
4) when you are sure the code works, write the code for the next sub-problem.
Once you get some code written, people here will be happy to review it, or answer specific questions.
I'd start with writing code to do nothing more than prompt the user for the employees name, then maybe repeat that back out so you know it works.
THEN add code to ask for the gross pay. THEN add code to loop around to allow mulitple names/pays to be input, and a way to exit out.
Seriously though, Fred's advice is excellent. Start out small and break it down into little pieces and you'll see that it's really not that tough. That is if you've at least gone to one or two classes!
Let's combine the "test" and "start small" suggestions into something very concrete. See if you can write PayStatement so that this works:
If not then you really need to work through some Java tutorials. The gang can recommend some great ones. But if you got that far, then add another test ...
Note that I didn't get into decimals for dollars and cents. Instead I used integer numbers of pennies. That's a big hint that handling decimals is going to be a pain, and I feel comfortable putting it off for a while.
[ September 07, 2005: Message edited by: Stan James ]