Background: For this exercise we are interested in using arrays to help us study the prices of 4-bedroom houses in Vigo County. In particular, we would like to know the
To see data like we'll give below, point your browser to http://www.trulia.com/home_prices/Indiana/.
Click on the Vigo County link on the Indiana map, then on the link for "Homes for sale in Vigo County". Make sure the "Homes for sale" checkbox is checked on the page that appears in your browser window.
You should see a a list of homes for sale that you can sort by address, price, type, beds, baths or broker. Sort by beds. You should see several pages of listings (with up to 15 listings on each page). You don't need to do anything with this data for the homework, but we wanted to show how the data could be acquired.
main.c
file, fill in the code for the function
findMean. findMean() takes an array and its size, and returns the mean of the values in the array. Test the findMean function by invoking it in the
main()
function and printing the value it returns. Your results should be formatted as shown below. The mean value of the array is x.
After testing and debugging this function, commit your work to your Subversion repository using a sensible log message.
The median value of the array is x.
After testing and debugging this function, commit your work to your Subversion repository using a sensible log message.
The n highest values in order are x1, x2, ..., xn.
After testing and debugging this function, commit your work to your Subversion repository using a sensible log message.
double houses[] = {129500.0, 129900.0, 138900.0, 159900.0,
44900.0, 490000.0, 89500.0, 34000.0, 82000.0, 219900.0,
47500.0, 144900.0, 159999.0, 99900.0, 166900.0, 229900.0,
240000.0, 89900.0, 299900.0, 49900.0, 585000.0, 275000.0,
209900.0, 259900.0, 269900.0, 389900.0, 86500.0, 99900.0,
79900.0, 175000.0, 54900.0, 139900.0, 129900.0, 34900.0,
119900.0, 257700.0, 149900.0, 139900.0, 149900.0, 174900.0,
145900.0, 189900.0, 212900.0, 48900.0, 75900.0, 330000.0,
17500.0, 235000.0, 449900.0, 179900.0, 119900.0, 147000.0,
155000.0, 239000.0, 219900.0, 309000.0, 131900.0, 345000.0,
165000.0, 299900.0, 45000.0, 230000.0, 99500.0, 83500.0,
156900.0, 289900.0, 45900.0, 185500.0, 19000.0, 124000.0,
159900.0};
Change the value of numberOfHomes in the line above the array initialization to 71.
[Note: We would not have to calculate this number by hand if we
were using Python. Can you see why?]. Using the functions you have implemented and tested above, have your program provide the information requested in question 4. Your output should be formatted as follows (substituting the actual values, of course):The mean price of 4 bedroom houses in Vigo County is $12345.67. The median price of 4 bedroom houses in Vigo County is $12345.67. The 5 most expensive 4 bedroom houses in Vigo County cost $12345.67, $12345.67, $12345.67, $12345.67, and $12345.67. The 5 least expensive 4 bedroom houses in Vigo County cost $12345.67, $12345.67, $12345.67, $12345.67, and $12345.67.