I am in school and I have to write a program that will determine the gross pay, taxes, and net pay for an employee. I have to use if-else statements to choose the tax rate the employee needs.
Hours must be between 1-40 and pay rate is 1-100$
tax rate:
2500 = .45
2000 = .40
1500 = .35
1000 = .30
less than 1000 = .25
I have tried so many different ways to do this and I can't figure it out for the life of me. I went to a tutor today and he wanted me to 1st create a flow chart, I said I am having problems with that as well. Of course he didn't do that so i left, and now my fate is in your hands, lol. Thanks for the help.
Let's say I work 40 hours and earn $55 per hour. Can you tell me what my tax rate is?
If so, write down the steps you took to figure it out. There's your flowchart.
All that's left is to turn that into code.
yeah I can figure that out, thanks for the input. But I am talking about the entire flow chart from start to finish. I can't figure out what information needs to be in place and in what order, I have this problem with other programs as well. I am in week 5 and I just finished week 1 work, so I have a lot to catch up on lol. As far as code, I am lost as well, maybe someone can help me walk through it from start to finish and then I can give the code a shot. Again, thanks for the help.
If you can tell me my tax rate, then I don't see why you can't figure out my gross pay (which you already had to calculate in order to get the tax rate), taxes and net pay.
Again, write down step by step what you did to get any of these results.
Take things one step at a time. For this program you have only a few steps to take:
1. Figure out how many variables that you need.
2. Figure out what data type those variables should be.
3. Ask the user to enter hours worked and their pay rate.
4. Store those into your variables.
5. Do math; C = A * B where A is hours worked and B is pay rate.
6. Make some if statements that will check to see what the tax rate is.
1 2 3 4
if (Earned >= 0 && Earned < 1000)
{
cout << "Tax Rate = 0.25%; Take Home Pay = " << Earned * 0.75 << endl;
}
There's really nothing to be 'chicken' about, it's not like "system(...)" where it's a preference of the users or the regular contributors. The stickey titled "Welcome -- read before posting!" is very clear:
Don't post homework questions
Programmers are good at spotting homework questions; most of us have done them ourselves. Those questions are for you to work out, so that you will learn from the experience. It is OK to ask for hints, but not for entire solutions.
EDIT: Now I suppose the OP didn't ask for a solution so no one is in direct violation of the rule. But Cheveytuff19 should have been aware of this sites policy.
Edited to add: Maybe I just missed reading it, but I re-read the rules posted at the top of this forum and it never said anything about posting solutions to problems like I did. It did say not to ask for the code for homework problems, but nothing against posting code. If someone wants to just copy and paste code into a compiler for their homework, then they won't learn the code (hence, that will only negatively affect them), but I actually got a lot of value from studying code that works and comparing it to my code with which I was having issues.