(Salesperson Salary Ranges) Use a one-dimensional array to solve the following problem. A company pays its salespeople on a commission basis. The salespeople each 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 follow- ing 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
```
#include
#include
using namespace std;
void wages( int [] ); // function prototype
void display( const int [] ); // function prototype
int main()
{
int salaries[ 11 ] = {}; // array to hold salaries
cout << fixed << showpoint;
wages( salaries ); // calculate wages
display( salaries ); // display ranges of wages
} // end main
// function that asks user to input gross sales
// and calculates employee salary based on input
void wages( int money[] )
{
double sales; // holds employee gross sales
double i = 0.09; // 9%, used for calculating salary
// prompt user for gross sales and store it in sales
cout << "Enter employee gross sales (-1 to end): ";
cin >> sales;
// calculate salary based on sales
// and prompt user for another employee sales amount
while ( sales != -1 )
{
double salary = 200.0 + sales * i;
cout << setprecision( 2 ) << "Employee Commission is $"
<< salary << '\n';
int x = static_cast< int > ( salary ) / 100;
money[ ( x < 10 ? x : 10 ) ]++;
cout << "\nEnter employee gross sales (-1 to end): ";
cin >> sales;
} // end while
} // end function wages
// function that displays table of salary ranges
// and number of employees in each range
void display( const int dollars[] )
{
// display table of ranges and employees in each range
cout << "Employees in the range:";
for ( int i = 2; i < 10; i++ )
cout << "\n$" << i << "00-$" << i << "99 : " << dollars[ i ];
cout << "\nOver $1000: " << dollars[ 10 ] << endl;
} // end function display
```
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 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
You might also like to view...
To include more than one expression in an expressionList, you separate each expression with a ____.
A. comma B. forward slash C. semicolon D. period
Fill in the code in the underlined location to display the mouse point location when the mouse is pressed in the pane.
``` import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.layout.Pane; import javafx.stage.Stage; public class Test extends Application { @Override // Override the start method in the Application class public void start(Stage primaryStage) { Pane pane = new Pane(); ______________________________________ Scene scene = new Scene(pane, 200, 250); primaryStage.setTitle("Test"); // Set the stage title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage } /** * The main method is only needed for the IDE with limited JavaFX * support. Not needed for running from the command line. */ public static void main(String[] args) { launch(args); } } a. pane.setOnMouseClicked((e) -> System.out.println(e.getX() + ", " + e.getY())); b. pane.setOnMouseReleased(e -> {System.out.println(e.getX() + ", " + e.getY())}); c. pane.setOnMousePressed(e -> System.out.println(e.getX() + ", " + e.getY())); d. pane.setOnMouseDragged((e) -> System.out.println(e.getX() + ", " + e.getY())); ```
?The dialog box shown in the accompanying figureof the Report Wizard of Microsoft Access 2016 lets you _____.
A. ?choose thegrouping levels for the detail records B. ?choosethe sort order for the detail records C. ?select a layout for the report D. ?select a page orientation for the report
Animation is applied to individual elements of a chart
Indicate whether the statement is true or false