Question

# Question 2: TMax 2a) Generate a random array In TMax.java,...

Question 2: TMax
2a) Generate a random array
In TMax.java, complete the getRandomArray() method that is responsible to generate a one dimensional
random array with the size of a random number between 2 and 10. Then populate the Array with some
random real values from [0, 1].
Note: you can set the seed by using the args in the main method.
Output examples:
The output results might be varied depends on the seed that you are using.
getRandomArray() -> [0.123, 0.235, 0.3573, 0.657]
getRandomArray() -> [0.067, 0.235, 0.657]
2b) Find the third biggest number in the array
Then, complete thirdBiggest(int[] array). This method should accept an array that we generated above
and return the third biggest number in this array. In the case of having less than three numbers that are
bigger than the rest of the elements, you should return the maximum.
Test case 1:
a -> [0.123, 0.235, 0.3573, 0.657]
thirdBiggest(a) -> 0.235
Test case 2:
a -> [0.067, 0.235]
As explained above in this case we should return the Maximum number.
Therefore:
thirdBiggest(a) -> 0.235

Solved by verified expert

sum do

ce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac,

Explore over 16 million step-by-step answers from our library

Step-by-step explanation

o.

gue

ac, dictum vitae odi

gue

m ipsum dolor sit amet, consectetur ad

gue

usce dui

gue

acinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie conse

gue

molestie consequat, ultrices ac magna. Fusce dui lec

gue

itur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus,

gue

ic

gue

lestie cons

gue

ongue vel laoreet a

a. Fusce dui lectus, congue v

cing elit. Nam lacinia pulvinar

gue

acinia pulvinar t

m ipsum

ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, conse

cing elit. Nam lacinia pulvinar tortor nec facil

m risus ante, dapibus a molestie consequat, ultri

facilisis. Pellentesque dapibus efficitur laoreet. N

itur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac m

nec facilisis. Pellentesque da

onec aliquet. Lorem ipsum dolor sit

s ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lect

nec facilisis. Pellentesque da

ipsum dolor sit amet, consectetur adipiscing

m ipsum dolor sit ame

acinia pulvinar t

acinia pulvinar t

gue

amet, consectetur adipiscing elit. Nam lacinia pulvinar tort

ce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. L

facilisis. Pellentesque dapibus efficitur laoreet. Nam

rem ipsum dolor sit amet, consectetur adipiscing elit.

usce dui lectus, congue vel laoreet ac, dictum vitae odio. Don

consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facili

molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum v

usce dui lectus, congue vel laoreet ac

usce dui lectus, congue vel laoreet ac

sus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congu

ur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna.

ce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet.

molestie consequat, ultrices ac magna. Fusce dui lectus, congue v

facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molest

risus ante, dapibus a molestie consequat, ultrices ac magna.

pulvinar tortor nec facilisis. Pellentesque dapibus effici

gue

pulvinar tortor nec facilisis. Pellentesque dapibus effici

molestie consequat, ultrices ac magna. Fusce dui lectus, congue v

trices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum d

ce dui lectus, congue vel laoreet ac, dictum vit

tesque dapibus efficitur laoreet. Nam ris

gue

entesque dapibus efficitur laoreet. Nam risus ante,

m ipsum dolor sit ame

acinia pulvinar t

acinia pulvinar t

acinia pulvinar t

ec facilisis. Pellentesque dapibus eff

ctum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet

sum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar

, consectetur adipiscing elit. Nam lacinia pulvinar tort

ongue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consec

ctum vitae odio. Donec aliquet. Lorem ipsum

Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor si

gue

llentesque dapibus efficitur laoreet. Nam risus ante, dapibu

ur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac m

acinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus

tesque dapibus efficitur laoreet. Nam ris

risus ante, dapibus a molestie consequat, ultrices ac magna.

gue

m ipsum dolor sit ame

gue

o

sum do

ris

ac, dictum vitae odio

gue

ipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultri

Fusce dui lectus, congue vel laoreet

risus ante, dapibus a molestie conseq

tesque dapibus efficitur

o. Donec aliquet. Lorem ipsum dolor

3 Attachments
png
png
png