Objectives – learn/practice the following new concepts:
BASIC REQUIREMENTS
PROJECT OVERVIEW
This project uses some of the data from the WorldData.csv file to create the Population Report (written to the data
file). This includes various statistics like average, lowest, highest, etc. in various categories.
INPUT FILE: WorldData.csv (a text file which has “Comma Separated Values”). This file contains basic data for
every country in the world (based on data from 2015). The 1st 4 records (lines) contain “meta-data”. The rest of
the records contain the actual data. Each data record contains these fields, in this order:
Number – ignore this field for this program
Country Name
Population
Yearly Change – ignore this field
Net Change – ignore this field
Population Density (Population/Km2) – ignore this field
Land Area (Km2) [FYI: to convert to square miles, multiply by 0.386102]
Migrants (net migration in (+) or out (-))
Fertility Rate – ignore this field
Median Age
Urban Pop % [contains % symbol which needs to be removed before processing data]
World Share % - ignore this field
PROCESSING:
A. SKIP THESE RECORDS (when doing ANY stats calculations or storing data in the parallel arrays):
1. the header records – i.e., the 1
st 4 records in the file
2. countries which have
a. nothing in Migrants field (that is, an empty string, which is ‘’”)
b. “N.A.” (“Not Available”) in the Median Age field
c. EITHER “N.A.” OR “0.0%” in the Urban Pop % field
B. When determining the Population, Land Area and Median Age stats – use the data STREAM processing
algorithm – that is, do the calculating as you’re reading the data in from the INPUT FILE
OUTPUT REPORT FILE: PopulationReport.txt – looks like the following:
[NOTE: The data below isn’t necessarily accurate, I’m just showing you the required formatting].
[NOTE: Use this exact formatting].
POPULATION REPORT
for the 198 countries of the world
(which excludes the 35 countries with “missing/bad” data)
POPULATION
Total: 3,123,456,789
China has the largest population: 1,388,232,693 people
Antigua and Barbuda has the smallest population: 93,659 people
LAND AREA
Total: 123,456,789 sq miles (= 234,567,890 sq km)
Russia has the biggest area: 6,592,769 sq miles (= 17,075,200 sq km)
XYZ has the smallest area: 2 sq miles (= 4 sq km)
MEDIAN AGE
Average: 28
Niger has the youngest: 15
Japan has the oldest: 47
MIGRANTS
Number of countries with
NEGATIVE (outgoing) migration:
500,000 or more 02
Between 100,000 and 499,999 09
Between 30,000 and 99,999 23
Between 10,000 and 29,999 33
Between 1 and 9,999 55
ZERO migration: 05
POSITIVE (incoming) migration:
500,000 or more 01
Between 100,000 and 499,999 14
Between 30,000 and 99,999 14
Between 10,000 and 29,999 09
Between 1 and 9,999 33
URBAN POPULATION
A number of countries with %-urban in these ranges:
Less than 25% 35
Between 25.1% and 50% 48
Between 50.1% and 75% 82
Between 75.1% and 90% 14
Greater than 90% 32
Get Free Quote!
327 Experts Online