jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes Java Program....Coding Help....Please! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Program....Coding Help....Please!" Watch "Java Program....Coding Help....Please!" New topic

Java Program....Coding Help....Please!

Coleman Fredericks

Joined: Sep 07, 2005
Posts: 1
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.

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.

Allison Nields
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

Michael Ernest
High Plains Drifter

Joined: Oct 25, 2000
Posts: 7292

That sounds an awful lot like a Pascal exercise I had in college.

Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Joanne Neal

Joined: Aug 05, 2005
Posts: 3742
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.

Joanne Neal

Joined: Aug 05, 2005
Posts: 3742
And as you are new to Java, you are probably better off posting in the Java in General (Beginner) forum, where most of your early questions will probably already have been answered - so try searching first.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

INdeed. Off to "Java in General (Beginner)" we go.

[Jess in Action][AskingGoodQuestions]
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11955

General tips when writing code:

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.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Hentay Duke
Ranch Hand

Joined: Oct 27, 2004
Posts: 198
I'll be happy to do it for ..... oh say $500. I'll just need your instructors email so I can ask him/her any questions I might have and send him/her the finished program.

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!
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Hi, welcome to the ranch!!

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 ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Rick O'Shay
Ranch Hand

Joined: Sep 19, 2004
Posts: 531
Well, sorry but I won't encourage you. You have not asked a Java question. Rather, you have an assignment that you would like somebody else to do for you. If you have specific questions fire away and you will get all the help that you could ask for.
I agree. Here's the link: http://aspose.com/file-tools
subject: Java Program....Coding Help....Please!
It's not a secret anymore!