# Trainee Selection Coding Program TCS NQT Problem Statement: Selection of MPCS exams include a fitness test which is conducted on ground. There will be a batch of 3 trainees, appearing for running test in track for 3 rounds. You need to record their oxygen level after every round. After trainee are finished with all rounds, calculate for each trainee his average oxygen level over the 3 rounds and select one with highest oxygen level as the most fit trainee. If more than one trainee attains the same highest average level, they all need to be selected.

Display the most fit trainee (or trainees) and the highest average oxygen level.

Note:

• The oxygen value entered should not be accepted if it is not in the range between 1 and 100.
• If the calculated maximum average oxygen value of trainees is below 70 then declare the trainees as unfit with meaningful message as “All trainees are unfit.
• Average Oxygen Values should be rounded.

Example 1:

• INPUT VALUES

95

92

95

92

90

92

90

92

90

• OUTPUT VALUES
• Trainee Number : 1
• Trainee Number : 3

Note:

Input should be 9 integer values representing oxygen levels entered in order as

Round 1

• Oxygen value of trainee 1
• Oxygen value of trainee 2
• Oxygen value of trainee 3

Round 2

• Oxygen value of trainee 1
• Oxygen value of trainee 2
• Oxygen value of trainee 3

Round 3

• Oxygen value of trainee 1
• Oxygen value of trainee 2
• Oxygen value of trainee 3
```import java.util.Scanner;

class Trainee {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
double sum1=0,sum2=0,sum3=0,avg1,avg2,avg3;
double o_level;
for(int i=0;i<=2;i++)
{
o_level=in.nextDouble();
sum1=sum1+o_level;
o_level=in.nextDouble();
sum2=sum2+o_level;
o_level=in.nextDouble();
sum3=sum3+o_level;
}
avg1=sum1/3;
avg2=sum2/3;
avg3=sum3/3;

if(avg1>avg2&&avg1>avg3)
System.out.println("Trainee Number : 1");
else  if(avg2>avg1&&avg2>avg3)
System.out.println("Trainee Number : 2");
else  if(avg3>avg1&&avg3>avg2)
System.out.println("Trainee Number : 3");
else  if(avg1==avg2&&avg1==avg3)
System.out.println("Trainee Number : 1\nTrainee Number : 2\nTrainee Number : 3");
else  if(avg1==avg2)
System.out.println("Trainee Number : 1\nTrainee Number : 2");
else  if(avg1==avg3)
System.out.println("Trainee Number : 1\nTrainee Number : 3");
else  if(avg2==avg3)
System.out.println("Trainee Number : 2\nTrainee Number : 3");
}

}
/*
OUTPUT
95
92
95
92
90
92
90
92
90
Trainee Number : 1
Trainee Number : 3
*/
```

Request:-If you found this post helpful then let me know by your comment and share it with your friend.

If you want to ask a question or want to suggest then type your question or suggestion in comment box so that we could do something new for you all.

If you have not subscribed my website then please subscribe my website. Try to learn something new and teach something new to other.

Thanks