Problem 29 - capita donations for this province. Year...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
ECOR 1606D Winter 2003/2004 In-Term Test #2 This question assumes a function that, given a province code (1 to 10) and a year (1920 to 2003), returns the per capita charitable donations for that province and year. The prototype for this function is as follows: double getPerCapitaDonations (int provinceCode, int year); You DO NOT have to write this function. Somebody else has done this job. All you have to do is use it. Part I Write a function that, given a year, returns the province code for the province with the highest per capita charitable donations. Your function should also “return” the per capita charitable donations for this province. In the event of a tie, any of the provinces involved may be chosen. Part II Suppose that we would like a table like that shown below. For each of a range of years, it gives i) the code for the province with the highest per capita donations and ii) the per
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: capita donations for this province. Year Province Per Capita Donation ($) 1984 4 634.56 1985 3 612.34 1986 10 601.77 1987 7 578.12 1988 3 601.44 Write a main function that produces this table. Your function should read in the start year and the length of the table. If the years entered are unreasonable (table length zero or negative, table would include a year outside of 1920 to 2003 inclusive) your function should output an error message and have the user try again, and so on, until reasonable years are entered. You may assume that input values will be numeric (i.e. you need not worry about using cin.fail()). The table produced must be formatted as shown. Columns must line up, and dollar amounts must be output with two decimal places....
View Full Document

Ask a homework question - tutors are online