![]() |
Solving for percentage Rates.
I'm attempting a code here. I'm still a little scrappy and I'm not quite sure what I should be using here. I'm trying to create a code where the user inputs a name for an employee and a sales rate. Each employee gets payed 2,500 monthly, but Based on the sales rate they should find out their commission rate and it's dependent on this.
$0.01–$5,000 8 percent $5,000.01–$10,000 10 percent $10,000.01 and above 12 percent I just need a little help here I think I need a case or switch statement, but I'm not even sure where to begin or place the needed codes. My code Code:
#include <iostream> |
Re: Solving for percentage Rates.
Quote:
For your question ... It's better to use nested Ifs than using Switch Case. Case checks for a particular value, but you need to check a range. So, do it something like this : Code: C
|
Re: Solving for percentage Rates.
Like this?
So it should be something like this? Code: C
|
Re: Solving for percentage Rates.
Quote:
As your post count is low, you cannot edit your posts. Keep posting and soon you will have edit button. |
Re: Solving for percentage Rates.
So should the code look like that? I think I need to add endline after the commissionRate.
|
Re: Solving for percentage Rates.
Quote:
Code:
#include <iostream>The correct program can be like this : (Run it and tell me if it's useful) Code: C
NOTE that, I changed system("pause") to manual a pause, which has the benefit that it's not OS specific. |
Re: Solving for percentage Rates.
Quote:
|
Re: Solving for percentage Rates.
Quote:
|
Re: Solving for percentage Rates.
Quote:
Mods are exceptions. |
Re: Solving for percentage Rates.
All right I appreciate the help.
|
| All times are GMT +5.5. The time now is 16:36. |