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.
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.
1 Comments
Even when punters play simple pokies, it’s required to look at a paytable and extra choices. When punters provoke monetary transactions, 카지노사이트 their banking details are comparability with} the data to the information provided during the registration. If they don’t match, an Internet on line casino can cancel the transaction and even block an account. Choose an appropriate deposit option to be able to|to have the power to} withdraw with it later. It’s important that Internet casinos enable payouts only with the device used for replenishments.
ReplyDelete