Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Java Program....Coding Help....Please!  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds an awful lot like a Pascal exercise I had in college.
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
author and iconoclast
Sheriff
Posts: 24220
40
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
INdeed. Off to "Java in General (Beginner)" we go.
 
lowercase baba
Bartender
Posts: 12627
50
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!