Question: this is exercise 1- the language is java language Please add annotation explaining each part please answer as soon as possible a) First of all

this is exercise 1- the language is java language

Please add annotation explaining each part

please answer as soon as possible

a)

First of all create, a class Professor which has two protected variables, one of them should be an int which is called age and the other should be of type string called researchArea.

Also, create two classes that inherit from Professor called economics and government.

b)

In the constructor of professor make the age random value between 15 and 99. Set researchArea to "generic".

Please add a toString method to Professor that returns a String which consists of the area and age of the professor.

c)

For this part, create a class called MainEx1 which has the main method. In the main method create an array length of 10. Next, you should assign random variables with one of the two classes you created that inherit from Professor to this array. Therefore, this means that there could be a mixture of both types of professors in the array.

After assigning the elements, print each element to the command line.

d)

Additionally, in the main method add a code to determine the age of the professor in your array, the range should be minimum to maximum and the most common research area. So for example, if the two types you defined, do research in the area ProfessorA and ProfessorB and there are more professors doing ProfessorA you should print ProfessorA as the most common field (as in the example below). If both types of professors occurred an equal number of times in the array print both equally common.

If anyone sees this answer please change it a bit

example - Mean age: 60, range 29 - 93, most common field: ProfessorA

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!