Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define a class Country that stores the name of the country, its population, and its area. Using that class, writea program that reads in a

Define a class Country that stores the name of the country, its population, and its area. Using that class, writea program that reads in a set of countries and prints:

- the country with the largest area

- the country with the largest population

the country with the largest population density (people per square kilometer)

Implement a loop in which the user is prompted to enter country information. Continue until either the user requests to quit or enters the area (or population) that is not a number or that is non-positive (in that case print out the message Incorrect input. Exit!). Then print out the names of the country with the largest population, area and density obtained up to this point. It can happen that there are more than one country with the largest area (or population, or density). For simplicity, print out the one that appears first in the list (see the input-output sample). If the input fails during the first iteration of the loop, then do not print anything besides the message Incorrect input. Exit!.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions