I've lost my will and need some guidence, yes this is homework, i'm not going to lie about that. I know I could probably figure out how to get the answer she's wanting, but not with what she's provided as a code template below. I'm guessing that I need to get the weekly gross and then calculate the .9% of the gross and then add $200. I'm thinking that once I have this amount, I'll need to use an array to see where they fall on the money scale and then truncate all the others left in memory? I have till Friday to get this done and have stressed out so much, that i can't seem to get started again. Any advice? Please be gentile, i'm fragile! Thanks
Pete
Use a single-subscripted array to solve the following problem. A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a salesperson who grosses $5000 in sales in a week receives $200 plus 9 percent of $5000, or a total of $650. Write a program (using an array of counters) that determines how many of the salespeople earned salaries in each of the following ranges (assume that each salesperson’s salary is truncated to an integer amount):
a) $200 - $299
b) $300 - $399
c) $400 - $499
d) $500 - $599
e) $600 - $699
f) $700 - $799
g) $800 - $899
h) $900 - $999
i) $1000 and over
Your output should appear in the following format:
Enter employee gross sales ( -1 to end ) : 10000
Employee commission is $1100.00
Enter employee gross sales ( -1 to end ) : 4235
Employee commission is $581.15
Enter employee gross sales ( -1 to end ) : 600
Employee commission is $254.00
Enter employee gross sales ( -1 to end ) : 12500
Employee commission is $1325.00
Enter employee gross sales ( -1 to end ) : -1
Employees in the salary range:
$200 - $299 : 1
$300 - $399 : 0
$400 - $499 : 0
$500 - $599 : 1
$600 - $699 : 0
$700 - $799 : 0
$800 - $899 : 0
$900 - $999 : 0
over $1000 : 2
[Note: We will use one variable chart for this problem even though we will have three code blocks: main, wages and display. Use of these variables is required; however, depending upon how you design your solution, you may use more variables.]
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
using std::ios;
#include <iomanip>
using std::setw;
using std::setiosflags;
using std::setprecision;
//function prototypes
void wages( int [] ); // function to calculate each salesperson’s salary + commission
// and to increment appropriate counter
void display( const int [] ); // function to display the cumulative results in array of counters
int main() // main will not require any modification
{
//variable declarations
int salaries [ 11 ] = { 0 }; // array of counters to track number of salespeople
// in each salary range
// calculate salaries and display results
wages( salaries );
display( salaries );
return 0;
} //end main
void wages ( int money[] ) // function definition skeleton only
{
// variable declarations
double sales, // gross sales for the week
commissionRate = 0.09, // a percent of gross sales
salary, // for current salesperson
// note: depending upon how you solve this, you may need more
// input control loop here
while ( ) {
} // end while
} // end wages
void display ( const int dollars[] ) // function definition skeleton only
{
// variable declarations
int index; // array subscript variable
for ( index = ?; index < ?; index++ ) {
} // end for
} // end display