For this project, you will design and implement a C++ program that generates a set of reports based on data from Statistics Canada’s Other livestock1 census, for the years 2011 and 2016. Your code will be correctly separated into object design categories, it will be designed for easy extensibility to additional categories of data, and it will meet every principle of good software engineering that we have covered in class.
The mandatory minimum criteria for grading this project is that all the requirements must be implemented, the code must meet all the listed constraints, it must execute correctly, and it must print the required reports to the screen. Submissions that are incomplete, or that don’t work correctly, or that don’t meet all the constraints, or that don’t print out resulting reports, will earn a grade of zero.
2. Data Set and Reports
You will use the Statistics Canada census data provided for you in the farms.dat file posted in cuLearn. This file contains data on nine types of animals living on farms in Canada, including the number of farms that host the animals, and the total number of animals living on those farms, for each region (province or territory) and agricultural sub-region in Canada, for the census years 2011 and 2016.
Statistics Canada’s Other livestock census category includes nine types of animals: horses/ponies, goats, llamas/alpacas, rabbits, bison/buffalo, elk/wapiti, domestic deer, wild boars, and mink.
Each record (i.e. each line) in the census data file gives us farm and animal statistics for a given year, region, agricultural sub-region, and type of animal. That record tells us how many farms reported data for that type of animal, in that sub-region, for that year, and it tells us how many animals were reported by those farms.
The records are formatted as follows: <year region subRegion animalType numFarms numAnimals> where year indicates a census year; region indicates either a province, or a territory, or “CAN” for all of Canada, where the farms and animals are located; subRegion specifies the agricultural sub-region for those farms and animals; animalType tells us which type of animal was counted for that record; numFarms tells us the number of farms that reported hosting animals of that type in that sub-region, for that year; and numAnimals indicates the total number of animals of that type reported as living on those farms.
The first record tells us that, in the census year 2011, there were 47,454 farms that reported they were hosting horses and ponies in Canada overall. Altogether, those farms reported that a total of 392,340 horses and ponies lived on those farms. The second record tells us that, in 2016, in the Ontario sub-region of Eastern Ontario, there were 143 farms that reported having llamas and/or alpacas, and altogether, they reported a total of 944 llamas and/or alpacas living on those farms.
Your program will use the census data provided in order to generate the following three (3) reports, when requested by the user:
2.1. a report listing the regional percentage breakdown of farms that hosted animals of each type in 2016
- 2.1.1. each row will show data for a region (province or territory), excluding Canada
- 2.1.2. each column will represent a type of animal, in addition to one last column showing the region’s percentage over all animals
- 2.1.3. each cell will show the percentage breakdown, for each region, of farms hosting that specific type of animal, over all regions
- 2.1.4. the cells of the last column will show the percentage breakdown, for each region, of farms hosting all types of animals combined, over all regions
- 2.1.5. the report rows will be ordered in descending order by regional percentage of all animal types, as shown in the last column
- 2.1.6. each column will add up to 100%
- 2.1.7. do not include Canada as a region in your calculations
- 2.1.8. do not include individual sub-regions in your calculations; you must use the numbers for the “All” sub-regions only
- 2.1.9. do not assume that the numbers for each region add up to the numbers for Canada; these are real- life statistics, and like most statistics, they contain omissions; to ensure that your columns add up to 100%, you must compute the correct number for the denominator for calculating the percentages
2.2. a report listing the animal type percentage breakdown for Canada, and for each animal type, the per- centage change from 2011 to 2016
2.2.1. each row will show data for an animal type
2.2.2. there will be three columns:
- (a) the percentage of animals of that type in Canada, over all animal types, in 2011
- (b) the percentage of animals of that type in Canada, over all animal types, in 2016
- (c) the change in percentage for each animal type, from 2011 to 2016
- 2.2.3. for example, horses and ponies represented 21.7% of all Other livestock animals in Canada in 2011, and 20.5% in 2016; this indicates a change of -1.2%
- 2.2.4. the first two columns will each add up to 100%
- 2.2.5. the rows will be ordered in ascending order by percentage change, as shown in the last column
- 2.2.6. you must show the positive or negative indicator (+/-) for the percentage change
- 2.2.7. you will use only Canada as a region in your calculations
2.3. a report listing the sub-region, within each region, that hosted the highest number of horses and ponies in 2016
2.3.1. each row will show data for a region (province or territory), excluding Canada
2.3.2. there will be three columns:
- (a) the region
- (b) the sub-region, within that region, that hosted the highest number of horses and ponies in 2016
- (c) the number of horses and ponies in that sub-region in 2016
2.3.3. the rows will be ordered in descending order by number of animals
3. Program Requirements
You will implement a program that reads in the census data from the farms.dat file posted in cuLearn, and you will present the user with a menu of the three possible reports. When the user selects an option, your program will compute the statistics required for the corresponding report, using the census data. It will print the results to the screen, and save them to a text file unique to that report.
Your program will implement the following requirements:
3.1. Design and implementation requirements
3.1.1. The program will be separated into objects that fit into the control, view, entity, and collection object design categories. You will have one view object, many entity objects, one primary control object that is in charge of the program control flow, several additional control objects that are responsible for report generation, and several objects of one collection class.