subject
Computers and Technology, 20.08.2020 18:01 nova97

Suppose that f contains an instance of the Family class whose myMembers instance variable contains at least one instance of Person. Which of the following code fragments outputs the age of the oldest Person in myMembers? I. Person p = f. myMembers. get( 0 );
for ( int i = 0 ; i < f. myMembers. size() ; i++ )
{
if ( p. getAge() < f. myMembers. get( i ).getAge() )
p = f. myMembers. get( i );
}
System. out. println( p. myAge() );

II. int i = f. getMembers().size() - 1;
int age = 0;
while ( i >= 0 )
{
if ( f. getMembers().get( i ).getAge() > age )
age = f. getMembers().get( i ).getAge();
i--;
}
System. out. println( age );

III. int n = f. getMembers().size();
Person p = null;
for ( int i = 0 ; i < n ; i++ )
{
if ( i == 0
|| f. getMembers().get( i ).getAge() > p. getAge() )
{
p = f. getMembers().get( i );
}
}
System. out. println( p. getAge() );

a. I only
b. II only
c. III only
d. II and III only
e. I, II, and III

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:10
The total cost of textbooks for the term was collected from 36 students. create a histogram for this data. $140 $160 $160 $165 $180 $220 $235 $240 $250 $260 $280 $285 $285 $285 $290 $300 $300 $305 $310 $310 $315 $315 $320 $320 $330 $340 $345 $350 $355 $360 $360 $380 $395 $420 $460 $460
Answers: 2
question
Computers and Technology, 22.06.2019 22:30
Jason needs to learn a new web tool. he went through his books to understand more about it. now he wants hands-on experience with using that tool. what would him? jason can use websites where workspace is provided to test the results of your code.
Answers: 2
question
Computers and Technology, 23.06.2019 19:30
2. fluorine and chlorine molecules are blamed fora trapping the sun's energyob forming acid rainoc producing smogod destroying ozone molecules
Answers: 2
question
Computers and Technology, 24.06.2019 06:30
Ineed to know the anwser to all these questions
Answers: 2
You know the right answer?
Suppose that f contains an instance of the Family class whose myMembers instance variable contains a...
Questions
question
Mathematics, 23.09.2019 21:30
question
English, 23.09.2019 21:30
question
English, 23.09.2019 21:30
question
Mathematics, 23.09.2019 21:30
Questions on the website: 13722367