The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 2 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Download the file WorldPopAndArea.txt. Save the file in the same folder as yoursource code file. We will use the contents of this file as data for our program. This filecontains the following information for each country in the World: name of the country, population of the country, and the area of the country (given in Km2). Here are the firstfew lines of this file:You and your parner will write a program that uses the data in WorldPopAndArea.txt tocalculate the population density for each country (that is, the number of people per squarekilometer). The results should be stored in an output file that contains: the names of thecountries and their population densities.Your program should: Ask the user to enter the names of the input file and the output file. Check that the input file can be opened. If not, then let the user know that there was aproblem opening the file. Call a function that receives the input and output file streams. This function will readall the data until the end of file, perform the density calculation for each country andsave the results in an ouput file. This is a void function. The output file should list the names of the countries aligned to the left, and thecountries population densities aligned to the right and with two decimal places. Hereis a sample of what the first few lines of a typical output file would look like:Do not forget to: Close the files once you are done using them  Have a comment on top of the function prototype explaining the function’s purpose,parameters, etc.
Â
Afghanistan 32738376647500Akrotiri15700 123Albania361977828748Algeria337696692381740American_Samoa57496 199Andorra72413 468Angola125313571246700Anguilla14108 102Antigua_and_Barbuda69842 443Argentina406773482766890Armenia296858629800Aruba101541193Australia206008567686850Austria820553383870Azerbaijan 817771786600Bahamas30745113940Bahrain718306665Bangladesh 153546901144000Barbados281968431Belarus9685768207600Belgium1040395130528Belize30127022966Benin8294941112620Bermuda66536 53Bhutan68232147000Bolivia92478161098580Bosnia_and_Herzegovina 459031051129Botswana1842323600370Brazil1919085988511965British_Virgin_Islands 24004 153Brunei3813715770Bulgaria7262675110910Burkina_Faso15264735274200Burma47758181678500Burundi869100527830Cambodia14241640181040Cameroon18467692475440Canada332126969984670Cape_Verde 4269984033Cayman_Islands47862 262Central_African_Republic4434873622984Chad 101113371284000Chile16454143756950China13300446059596960Christmas_Island 1402135Cocos_Islands59614Colombia450136741138910Comoros7317752170Congo,_Democratic_Republic_of_the665145062345410Congo,_Republic_of_the3903318342000Cook_Islands21923 237Costa_Rica 419591451100Cote_d'Ivoire18373060322460Croatia449154356542Cuba 11423952110860Cyprus7926049250Czech_Republic1022091178866Denmark548472343094Dhekelia15700 131Djibouti50622123000Dominica72514 754Dominican_Republic950713348730Ecuador13927650283560Egypt817135171001450
Attachments: