Probably a basic question, but I need to be able to do calculate a problem in c++ but cant figure this out. Here goes... I need to be able to calc the first 75000 * .10, the next 25000 + .05 and anything higher after that + .01. I tried and if statement to like this:
if ( numEntered > 75000 < 100000 )
but that allways creates a warning. I need to be able to specify a range, without using functions and classes. This is my first basic project but I just cant figure this out. Here is my assignment to help you get a better understanding:
Problem
Write a program to calculate and display an IRS informant's reward for recovering monies owed the government.
Specifications
1. IRS informants are paid cash rewards on the value of the money recovered. If the information was specific enough to lead to a recovery, the informant receives 10% of the first $75,000, 5% of the next $25,000, and 1% of the remainder, up to a maximum award of $50,000.
2. Write a program that requests the amount of the recovery as an input and displays the reward. Assume that if the informant enters an amount, the information was specific enough to receive the award.
3. Follow this sequence in program execution:
Prompt user to enter an appropriate value of money recovered.
Loop until a positive number has been entered, prompting each time you loop.
Calculate the person's award
Display the person's award in a nice neat manner
4. Format the award amount so it is displayed with a $ and two decimal places.
5. Test your code with numbers such as -5, $10,000, $125,000, and $10,000,000. Be sure you get the correct award amounts for each.
6. Be sure to use good programming practices and the C++ language constructs.
Here is the code I have so far, compiles with not errors but I cant figure the range thing out. Any help is much apprecaited, thanks as I am a newbie.
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
double numEntered = 0;
cout << "Enter the value of money recovered" << endl;
cin >> numEntered;
while ( numEntered < 0 ) {
cout << "Enter a valid number" << endl;
cin >> numEntered;
}
if ( numEntered <= 75000 )
cout << numEntered * .10 << endl;
if ( numEntered > 75000 )
cout << numEntered * .15 << endl;
if ( numEntered > 100000 )
cout << numEntered * .16 << endl;
return 0;
}null
if ( numEntered > 75000 < 100000 )
but that allways creates a warning. I need to be able to specify a range, without using functions and classes. This is my first basic project but I just cant figure this out. Here is my assignment to help you get a better understanding:
Problem
Write a program to calculate and display an IRS informant's reward for recovering monies owed the government.
Specifications
1. IRS informants are paid cash rewards on the value of the money recovered. If the information was specific enough to lead to a recovery, the informant receives 10% of the first $75,000, 5% of the next $25,000, and 1% of the remainder, up to a maximum award of $50,000.
2. Write a program that requests the amount of the recovery as an input and displays the reward. Assume that if the informant enters an amount, the information was specific enough to receive the award.
3. Follow this sequence in program execution:
Prompt user to enter an appropriate value of money recovered.
Loop until a positive number has been entered, prompting each time you loop.
Calculate the person's award
Display the person's award in a nice neat manner
4. Format the award amount so it is displayed with a $ and two decimal places.
5. Test your code with numbers such as -5, $10,000, $125,000, and $10,000,000. Be sure you get the correct award amounts for each.
6. Be sure to use good programming practices and the C++ language constructs.
Here is the code I have so far, compiles with not errors but I cant figure the range thing out. Any help is much apprecaited, thanks as I am a newbie.
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
double numEntered = 0;
cout << "Enter the value of money recovered" << endl;
cin >> numEntered;
while ( numEntered < 0 ) {
cout << "Enter a valid number" << endl;
cin >> numEntered;
}
if ( numEntered <= 75000 )
cout << numEntered * .10 << endl;
if ( numEntered > 75000 )
cout << numEntered * .15 << endl;
if ( numEntered > 100000 )
cout << numEntered * .16 << endl;
return 0;
}null