I need to write a program to find the mean and median of house prices in Cape based on last month’s sale of 25 houses. Their sale prices in $ ‘000 were: 174.5, 163.4, 150, 201.5, 198, 156.5, 170, 160, 147, 139, 196, 157, 161, 155, 140, 166, 162, 172, 177, 181, 185, 189, 192, 163.5, 175. Note: Mean = sum of the prices of the 25 houses / 25. The median is given by the middle value of the sorted (in either ascending or descending order) housing prices of the 25 houses. Use a sorting function void sort(…..) and the two other functions sort uses (given in text on pages 413-14). The median will be the middle element (25/2) in the sorted array. The program should output the sorted housing prices and also the mean and median prices. using #include <iostream> #include <cmath> using namespace std; // put all the function prototypes including mean, sort, swap_values, index_of_smallest // the last three are defined in text pp419 and 420 – jIt is okay to use them int main () { const int HOUSES_SOLD = 25; double price[HOUSES_SOLD]; // use a for loop to input the sale prices double sorted_price[HOUSES_SOLD]; // use a separate array so the original is still there // complete the program } // write the definitions for all the functions including mean (that returns the mean price). |