Complex program using switch statement
Hi Experts , Please help me the code for below scenarion.
Input Screen 1
Enter the number of tests: 3
Enter 1st Internal details as below.
Enter Subject 1, Subject2, subject 3 Marks:
Enter 2nd Internal details below.
Enter Subject 1, Subject2, subject 3 Marks:
Enter 3rd Internal details below.
Enter Subject 1, Subject2, subject 3 Marks:
Output Screen
Subjects Name Total Marks Avg Marks
S1
S2
S3
Do you want to exit ? y
If “N” Enter new students marks details
Logic:
For each subject the total and averages marks are calculated from the best of 3 internals which are entered.
EX: 15 24 25
After this need to add 25 and 24. Then take Avg and display for each subject
25+24 = 49
49/2 = 24.5
To get 1st highest score among 3 internals
IF (IA1_S1 >= IA2_S1 AND IA1_S1 >= IA3_S1) then IA1_S1 NULL (Condition fails)
ELSE IF (IA2_S1 >= IA1_S1 AND IA2_S1 >= IA3_S1) THEN IA2_S1 NULL
ELSE IF(IA3_S1 >= IA1_S1 AND IA3_S1 >= IA2_S1) THEN IA3_S1 25
To get 2nd highest score among 3 internals
IF(IA1_S1 >= IA2_S1 AND IA1_S1 >= IA3_S1)
IF(IA2_S1> IA3_S1) THEN IA2_S1 ELSE IA3_S1 NULL
IF(IA2_S1 >= IA1_S1 AND IA2_S1 >= IA3_S1)
IF(IA1_S1> IA3_S1) THEN IA1_S1 ELSE IA3_S1 NULL
IF(IA3_S1 >= IA1_S1 AND IA3_S1 >= IA2_S1)
IF(IA2_S1> IA1_S1) THEN IA2_S1 ELSE IA1_S1 24