#GPA1. GRADE POINT AVERAGE

GRADE POINT AVERAGE

Problem 1: GRADEPOINTAVERAGE

Problem Statement:

Every student of a college has to write 3 internal assessments and 1 final exam on each semester for all the 6 subjects.  Each internal assessment mark is out of 20 and the final exam mark is out of 100. The best two of three assessment marks is chosen and those marks are considered to be out off 45. The final exam mark is considered to be out off 50. The rest 5 marks is allotted based on the percentage of attendance of the student.

Attendance mark allotment

Below 51% attendance – 5 marks

Below 61% attendance – 4 marks

Below 71% attendance – 3 marks

Below 81% attendance – 2 marks

Below 91% attendance – 1 mark

else –No mark for those sincere students

Some students even bunk the assessments. If he bunks then instead of the mark ‘ab’ symbol is used which denotes “absent”. But no one bunks the final exam.

No attendance is taken during exam days

For each subject there’ll be some credit allotted by the department based on the importance of the subject.

 

Total marks in a particular subject = best two out of three assessments(45%)

                                                    + attendance mark(5%) +Final exam mark(50%)

 

Points out off 10:

%Total mark in a subject                                                       Points

>=91                                                                                      10

>=81                                                                                      9

>=71                                                                                      8

>=61                                                                                      7

>50                                                                                        6

==50                                                                                      5

<50                                                                                        0   

If the student scores 0 point in any of the subjects then he’s declared as FAILED else he’s declared as PASSED

Mr.Chintumani, a professor of Computer Science department of the college designed a software program to calculate the GRADEPOINTAVERAGE(GPA) of the student and to determine whether the student is “PASSED” or “FAILED"

GPA=  sum of (credit*points) for all the subjects / total number of credits of all the subjects

 

Input:

The first line consists of an integer n, the number of students in the class. Then n test cases follows, in each test case the first line consists of 6 integers a,b,c,d,e and f, the credits of the 6 subjects. Then for the next 6 lines, each line(each subject) consists of 5 numbers(the first three numbers are the assessment marks out off 20, the fourth is the final exam mark and the fifth is the percentage of attendance).

 

Output:

Assume you are Prof. Chintumani and print the result and GPA(rounded to two decimal places) per line for each student in the format as given in the example output.

 

Example:

Sample Input:

1

1 1 1 2 2 3

19 18 20 70 70

17.33 15 16.66 66 70.66

ab ab ab 0 100

ab ab 10 78 78

17 18.33 19.5 64 87

14 8 ab 60 45

Sample Output:

FAILED, 6.30

 

Explanation of  the testcase:

There is only 1 student

In the Subject 0, he got 19,18 and 20 as internal marks, considering best two of three his internals score is 43.875/45.

His final exam score is 35/50

His attendance mark is 3

So the total marks he got in that subject is 81.875 which leads to 9 points.

Similarly he gets

Subject 1:  74.2387 --> 8 points

Subject 2:  0 --> 0 points

Subject 3:  52.25 --> 6 points

Subject 4:  75.5588 --> 8 points

Subject 5: 59.75 --> 6 points

 

Gpa= (9*1 + 8*1 + 0*1 + 6*2 + 8*2 + 6*3 ) / (1+1+1+2+2+3) = 6.30

Since he got 0 points in atleast one of the subjects he is FAILED

The output format is “RESULT,<space>gpa” without double quotes.