Question: c needed use functions do not use global variables all...
USE FUNCTIONS. DO NOT use global variables. All data must be
functions using parameters. A car dealership wants to process sales information for
each of his dealers. Ask the user to enter the name of a data file that contains the name
and amount of sales. Issue an error message, if the file does not exist and ask again
for the file name. Create your own data file for this exercise and make sure to submit the
file with your submission. Assume the names have the format firstname_last name and
that sales values are decimal values. For each dealer, store the name of the dealer and the
amount of sales in 2 parallel arrays. If a value for sales amount happens to be negative,
set the value to 0. Calculate amount of commission in dollars based on the following
table and store it in another array:
$1 - $5,000 8%
More than $5,000 to $15,000 15%
More than $15,000 20%
Write a function to gather the required input data.
Write a function to calculate the commission array.
Write a function to calculate and return total sales and the
average sales for the
dealership. Total and average sale values do not include the commission. The total value
must be returned from the function and the average value must be returned using a pass
by address variable.
Write a function to calculate and return the total commission for the dealership.
Write a function to display the dealer name and amount of sales
and the amount of
commission for all dealers in a tabular format.
In your main function, make sure to call your functions to
perform the operations.
MAKE sure to display all the calculated data returned by your functions. For
example, the totals and averages must be displayed, so the answers could be
checked. Make output descriptive and provide 2 digits after the decimal point for all
Here is what the data file may look like the following: