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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

1) Execute the following R commands in RSTUDIO: thisNumber

Answered: 1 week ago