Question: C + + using namespace std; only please Statistics is a branch of mathematics dealing with the collection, analysis, interpretation, presentation, and organization of data.
C using namespace std;
only please
Statistics is a branch of mathematics dealing with the collection, analysis,
interpretation, presentation, and organization of data. In this program, you will be
conducting a statistical analysis over the top automotive vehicles sold in the
United States in The following table shows the top ten vehicles sold in the
United States in :
Ford FSeries Ford Motor Co
Chevrolet Silverado General Motors
Ram Chrysler Corp.
Toyota Rav Toyota
Tesla Model Y Tesla
Honda CRV Honda
GMC Sierra General Motors
Toyota Camry Toyota
Nissan Rogue Nissan
Jeep Grand Cherokee Chrysler Corp.
To analyze these data, your program should do the following:
You need a salesArray with integers. If you need a different data type,
feel free to modify the parameter data types provided below.
All data will be read from the attached data file sales.txt
Declare a pointer name ptr that is initialized to the starting location of
the autoSales array
const int SIZE ; Do this in main
int ptr new int size; dynamically allocate an array in getData
function
The program should then find the maximum sales, the minimum sales, the
average sales, and display all elements forward and backwards, and sorting
with the selection sort algorithm using two different ways of pointer
access.
Remember, the main function should serve as the driver to all, so your
main function should only declare the variables and call the other functions
occasional cout statements are fine
Functions:
int getData int size
This function should dynamically
allocate an array pointed to by ptr The
data of the sales of vehicles should
be loaded into the array from the data
file sales.txt
NOTEThis data is in a format the may
be unfamiliar at this point. Here is the
code to most easily read a record see
Chapter Section The getline
Function for an explanation
input rank;
input.ignore;
getlineinput name, ;
input sales;
getlineinput manuf;
If you have questions about this, let me
know.
int getAverageconst int ptr int size;
This function should find the average
sales of all autos. NOTICE: fractional
autos do not exist, so the return value
must be casted to an integer. Also
calculate and display the total
population.
void displayForwardconst int ptr int
size;
Show all sales from the first value to the
last value. All numbers must be
displayed in a space of positions and
left justified. Display five sales values
per line as shown in the sample output
below.
int getMaxconst int ptr int size;
int getMinconst int ptr int size;
Find the largest sales number. NOTICE:
the largest value may not be the first
value nor the last. You cannot call a sort
before calling getMax.
Find the smallest population. NOTICE:
the smallest value may not be the first
value nor the last. You cannot call a sort
before calling getMin.
void displayBackwardconst int ptr int
size;
Show all population values from the last
value to the first value. All numbers
must be displayed in a space of
positions and left justified. Display five
sales values per line as shown in the
sample output below.This function
should be executed after the
selectionSort function is executed.
void selectionSortint const pIntArray,
const int size;
This function will sort all sales numbers
from the smallest to the largest using
the selection sort method. You may also
need to add a swap function to make
the sort work.
feel free to add more functions if needed.
Use the sales data I provided in the data file sale.txt Do not modify the
file.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
