Question: I need this written in JAVA fast. Create a class Country with following attributes: private String code; private String name; private String continent; private List
I need this written in JAVA fast.
Create a class Country with following attributes:
private String code;
private String name;
private String continent;
private List
Create class City with following attributes:
private int id;
private String name;
private int population;
private String countryCode;
Generate parametrized constructors and getters and setters for all classes
In the main method initialize list of countries with following example values:
Country name: Netherlands, Continent: Europe, County code: NLD
Cities:
City name: Amsterdam, City population: 731200
City name: Rotterdam, City population: 593321
City name: Haag, City population: 440900
***********************************************************************************
Country name: Germany, Continent: Europe, County code: DEU
Cities:
City name: Berlin, City population: 3386667
City name: Hamburg, City population: 1704735
City name: Munich, City population: 1194560
***********************************************************************************
Country name: United States, Continent: North America, County code: USA
Cities:
City name: New York, City population: 8008278
City name: Los Angeles, City population: 3694820
City name: Chicago, City population: 2896016
***********************************************************************************
Country name: Armenia, Continent: Asia, County code: ARM
Cities:
City name: Yerevan, City population: 1248700
***********************************************************************************
Country name: Argentina, Continent: South America, County code: ARG
Cities:
City name: Buenos Aires, City population: 2982146
***********************************************************************************
Country name: Brazil, Continent: South America, County code: BRA
Cities:
City name: Rio de Janeiro, City population: 5598953
Using java stream create a program that will:
print the countries' details as shown above
print all the continents (without duplicates)
print all the country names from North America and South America (only country titles, not the whole objects)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
