As basis for the assignment, we use a CSV file named country.csv in which information about
countries is recorded. This file is posted on the assignment Web page1. The first line in the file is
the header line and describes the content of each column. The first value in a line is the name of the
country, the second is the name of the capital, the third is the total area (in km2), the fourth is the ISO abbreviation for the country’s name, and the last one gives the country’s population. Take a look at
the file using some standard text editor such as Notepad.
Your program has to determine the name and population of all those countries whose area is below
or equal to a number entered by the user. The names of all those countries including their population
needs to be written to a file named results.txt. That is, your program does not print the result
on screen but writes it to the file results.txt.
Here is a sample session:
Please enter the maximum total area: 7
6 countries found.
Please open the file results.txt to see the results.
Based on the above input, your program should create the file results.txt with the following
content.
Gibraltar 27833
Holy See (Vatican City) 921
Johnston Atoll 396
Juan de Nova Island 10
Kingman Reef 5
Monaco 32270
urmybaby 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.