Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class called Country. It contains two private variables for the name of a country and the population of a country. Give it a

Create a class called Country. It contains two private variables for the name of a country and the population of a country. Give it a constructor that sets those variables. Give it get methods for the name and population variables. In your Main method, write code that requests name and population data from the user. Use that data to instantiate Country objects. Store those objects in an ArrayList that has been configured to only contain Country objects. Your code should allow for an indefinite number of Country objects to be created and loaded that way (i.e. all of the above is in a loop). Also in your Main method, include code that allows the user to enter country names. The program should find that country name in the ArrayList and display the associated population. If it cannot find a match, display a message to that effect. This code should also be in a loop that runs until the user tells it to stop.

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

More Books

Students also viewed these Databases questions

Question

=+3. What technique does the TAT (or PSE) involve?

Answered: 1 week ago