Write in java: Define a class called Country. A Country has populationSize, area, capital, currency, and abbreviation (2-3 letters taken from the country name). Define at least two constructors, at least two getter methods, at least two setter methods, and Override the toString() and the equals() methods. The equals() must return true if the two countries have the same capital and populationSize and returns false otherwise. The abbreviation is the second letter and first letter of the country name and must be generated automatically (e.g. if the country name is Palestine the abbreviation is AP, if the country name is Jordan the abbreviation is OJ.) Write a main method, define an array of country objects, read countries data from the user, if two countries have the same abbreviation add the last letter from the country name to the abbreviation of the country inserted last. Display countries whose capital name ends with the letter ‘a’ or ‘A’
Write in java:
Define a class called Country. A Country has populationSize, area, capital, currency, and abbreviation (2-3 letters taken from the country name). Define at least two constructors, at least two getter methods, at least two setter methods, and Override the toString() and the equals() methods. The equals() must return true if the two countries have the same capital and populationSize and returns false otherwise.
The abbreviation is the second letter and first letter of the country name and must be generated automatically (e.g. if the country name is Palestine the abbreviation is AP, if the country name is Jordan the abbreviation is OJ.)
Write a main method, define an array of country objects, read countries data from the user, if two countries have the same abbreviation add the last letter from the country name to the abbreviation of the country inserted last. Display countries whose capital name ends with the letter ‘a’ or ‘A’
Trending now
This is a popular solution!
Step by step
Solved in 2 steps