Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 researchA.

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 researchA to "generic".

Please add a toString method to Professor that returns a String which consists of the area (the A in resarchA is 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

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions

Question

What are the challenges associated with tunneling in urban areas?

Answered: 1 week ago

Question

What are the main differences between rigid and flexible pavements?

Answered: 1 week ago

Question

What is the purpose of a retaining wall, and how is it designed?

Answered: 1 week ago

Question

How do you determine the load-bearing capacity of a soil?

Answered: 1 week ago

Question

what is Edward Lemieux effect / Anomeric effect ?

Answered: 1 week ago