Question: Define class Continent that has two instance variables name and numberOfCountries . Define three overloaded constructor methods: no-argument constructor (receives no name and no numberOfCountries),

Define class Continent that has two instance variables name and numberOfCountries. Define three overloaded constructor methods: no-argument constructor (receives no name and no numberOfCountries), one-argument constructor (receives only name) and two-argument constructor (receives name and numberOfCountries). Additionally, define all sets and gets methods. In the main method, define three objects of class Continent and test the three constructors and print all information of the continent that has largest number of countries. The number of countries in each continent is shown in the following table.

Continent

Number of countries

1

Asia

50

2

Africa

54

3

North America

23

4

South America

12

5

Antarctica

0

6

Europe

51

7

Autralia

14

Note: Inside the main method, write a line to greet the user by printing a message that has your name on it. Example: Hello! My name is ali turki . If you do not do this you will get ZERO.

Post a copy of your complete code inside the box below:

Post a screen-shot of the codes output inside the box below:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!