Starting from:
$35

$29

Project 0, World Education Statistics Calc Solution

Objectives

The objective of this programming assignment is to have you practice inheritance, I/O, and basic C++ programming to prime you for the rest of the semesters work.




Introduction

You are (or probably are not) interested with the correlation between the expenditure of different countries on their public schooling and the corresponding literacy rates, as well as the differences in education in different countries between males and females. You’ve decided (or rather, have been told) to look into the statistics from the world bank on said things, and create a ranking of the countries with the highest literacy rates, primary school completion rates, and percent of GDP spent on education for each continent.




Classes

You will want to break this down into at least two classes, the Country class and the Continent class, Continent should be the child of the Country class for how you want to display the data. The classes should use the following UML.
























Inheritance

The country class will be the parent class of the continent class. If you do not remember how inheritance works in C++ feel free to refer back to Professor Lupoli’s C++ inheritance notes --HERE--. (HINT: You will want to add the populations from all of the countries to create the population for the continent.)


Input using File I/O

You will be given two files, one that contains all of the statistical data for the countries (2013WorldBankEducationCensusData.txt) , and one that contains which countries belong in which continents (CountriesContinents.txt). If you don’t remember how to do file I/O from 202, feel free to review Professor Lupoli’s C++ File I/O notes --HERE-- . You will need to create instances of the country class for each country in the statistical data set and match said country to the corresponding continent. In the file that states which countries belong in which continents you will notice that each continent is written in all caps, and has the number of countries within the continent on the same line. Note that there are some countries that are not included in the statistics, so you will want to first parse the statistical data and then sort the countries into continents in that order.


You’ll note that in the file containing statistics, some countries are missing data and have “N/A” in that place, you will be recording this data in the country class as a -1 instead of 0. Every country has a population, so it is possible that the country with the highest population in a continent may not have statistics for other variables.
A good way to parse this data would be to split each line into a vector of tokens and translate into floats and longs from there.


Calculations

You will be calculating the total population for the continent, and searching for the country within the continent that has the highest % of GDP spent on education, population, and total literacy rate. Your overloaded << operator for the continent class will print out these statistics (see output section).


Output


Your file output for should look like so, using the overloaded COUT for the continent class:





(sample output may be slightly different for you (Sudan) )




Input Files Given

You have been given links to the sample input files. Since they are both very large, there might be some minor naming discrepancies. At this point anymore discrepancies in the file you are not accountable for, do not try to match anything that does not already match in the updated files.




There are a few more countries that don't match as well but it's been pretty tedious to try to find all of them so from here on out you should just match the ones that already match, as posted in the notification on piazza!




Support

A Piazza discussion board has been set up for questions. Please remember to use “Project 0” and that a TA will only look at it periodically so fellow students may have answered the question first.




What to Submit

You should zip all of your C++ source code with .cpp/.h files under the src directory. You do not need to submit the text files. You must also supply a Makefile build file.




In particular, the following Unix commands should work.




cd ~/cs341class/proj0/src (or whatever directory you have it in)

make run

make clean




The command “make run” should simply run the project that compiled successfully.

More products