Home › Forums › C Programming › Please help me~!! i dunno do
- This topic has 1 reply, 1 voice, and was last updated 18 years ago by Anonymous.
- AuthorPosts
- November 11, 2006 at 4:29 am #1953AnonymousInactive
Can anyone please help me…. i understand the question but i dunno how to program it… my stupid code cannot work Please help~~~ I beg you… really beg you
The Grade Point Average (GPA) is a number, calculated to 3 decimal places (eg. 2.375), which indicates the performance of a student in an examination. It is calculated by the formula:
GPA = Total Quality Points / Total Credits (for all units taken)For each unit taken,
Quality Point (QP) = Grade Point * Credits
[ Grade Point = 4, 3, 2, 1, 0, 0 for grades A, B, C, D, E, F respectively; ]
[ Credits is obtained from the last digit of the Unit Code. ]Eg. if a student scores ‘B’ for AACS1084, and ‘C’ for AACS1123, his GPA is:
GPA = (QP for AACS1084 + QP for AACS1123)
Credits for 1084 + Credits for 1123= (3 * 4) + (2 * 3) = 12+6 = 2.571
4 + 3 7Q1.(a) Create 2 arrays to store the grades of all students in a class. The grades for each unit are to be keyed in by the user and stored in an array. (ie. one array for AACS1084 grades and another array for AACS1123 grades. The first student’s grades will be stored as the first element of each array, 2nd student’s grades as the 2nd element, etc.)
Note: The number of students in a class is not fixed. Use DEFINE CLASS_SIZE to cater for the required size.
(b) Create a third array and fill it with the calculated GPAs of the students of the classes. (eg. The first student’s GPA will be stored as the first element.)
(c) Two reports are to be displayed: Examination Performance Report and Results Analysis Report). Refer to the report formats on page 2. You will need to access the appropriate arrays you have created earlier, and create more arrays where necessary.
Q2.(a) Define a structure variable that can store an index number (eg. 11234ADIB), a student’s full name (eg. Stephen Chow), and the gender of the student (eg. ‘M’). Create an array of this structure to store details of all students in the class. The details are to be keyed in by the user. (The first student’s details will be stored as the first element of the array, and so on.)
(b) An Examination Result Notification is to be produced for every student. Refer to the format on page 2. You will need to access most of the arrays you have created in Q1 and Q2(a).EXAMINATION REPORT
12345678910111213141516171819202122232425262728293031323334353637383940414243444546Student No. AACS1084 AACS1123 Grade Point Average<hr class="bbcode_rule" /><hr class="bbcode_rule" /><hr class="bbcode_rule" /><hr class="bbcode_rule" />1 B C 2.571<br />2 D C 1.429<br />3<br />:<br />:<br />AVERAGE GPA = … …<br />HIGHEST GPA = … … obtained by Student No. …<br />LOWEST GPA = … … obtained by Student No. …<br /><br />RESULTS ANALYSIS<hr class="bbcode_rule" /><br />A B C D E F total<br /><br />AACS1084 4 10 9 9 2 1 35<br />AACS1123 3 … … … … … …<br /><br />total 7 … … … … … …<br /><br />EXAMINATION RESULT NOTIFICATION<hr class="bbcode_rule" /><br />TO:<br />MR. STEPHEN CHOW INDEX NO 11234ADIB<br /><br />Your examination results are as follows:<br /><br />UNIT CODE UNIT TITLE GRADE<hr class="bbcode_rule" /><hr class="bbcode_rule" /><hr class="bbcode_rule" />AACS1084 Programming Concepts & Design II B<br />AACS1123 Principles of Information Systems C<br /><br />GRADE POINT AVERAGE: 2.571<br />i nid this by 17 of november >.<
- November 11, 2006 at 5:29 am #3210AnonymousInactive12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091#include <br />#include <br />DEFINE CLASS_SIZE 4<br />void main()<br />{<br />/*Local Declaration*/<br />char gradeAACS1084[CLASS_SIZE],gradeAACS1123[CLASS_SIZE];<br />float scoreAACS1084[CLASS_SIZE],scoreAACS1123[CLASS_SIZE] ;<br />float solutionGPA[CLASS_SIZE],totalsolutionGPA=0.000;<br />float lowestGPA=4.000,highestGPA=0.000;<br />int highGPAstudent,lowGPAstudent;<br />/*============================== get input grade ==============================*/<br />for(a=1;a<=CLASS_SIZE;a++){<br />printf("Please Input the score for >n");<br />for(a=1;a<=CLASS_SIZE;a++){<br />printf("nStudent %dnn",a);<br />printf("AACS1084( Programming Concepts & Design II ): ");<br />scanf("%c",&gradeAACS1084[a]);<br />printf("nn");<br />printf("AACS1123( Principles of Information Systems ): ");<br />scanf("%c",&gradeAACS1123[a]);<br />printf("nn");<br />}//Get Grade<br />/*============================== Convert PCD2 Score ==============================*/<br />for(a=1;a<=CLASS_SIZE;a++){<br />if(toupper(gradeAACS1084[a])=='A')<br />scoreAACS1084[CLASS_SIZE]=4.000;<br />else if(toupper(gradeAACS1084[a])=='B')<br />scoreAACS1084[CLASS_SIZE]=3.000;<br />else if(toupper(gradeAACS1084[a])=='C')<br /><br />scoreAACS1084[CLASS_SIZE]=2.000;<br />else if(toupper(gradeAACS1084[a])=='D')<br /><br />scoreAACS1084[CLASS_SIZE]=1.000;<br />else if(toupper(gradeAACS1084[a])=='E')<br /><br />scoreAACS1084[CLASS_SIZE]=0.000;<br />else if(toupper(gradeAACS1084[a])=='F')<br /><br />scoreAACS1084[CLASS_SIZE]=0.000;<br />/*============================== Convert PIS Score ==============================*/<br />if(toupper(gradeAACS1123[a])=='A')<br /><br />scoreAACS1123[CLASS_SIZE]=4.000;<br />else if(toupper(gradeAACS1123[a])=='B')<br /><br />scoreAACS1084[CLASS_SIZE]=3.000;<br />else if(toupper(gradeAACS1123[a])=='C')<br /><br />scoreAACS1123[CLASS_SIZE]=2.000;<br />else if(toupper(gradeAACS1123[a])=='D')<br /><br />scoreAACS1123[CLASS_SIZE]=1.000;<br />else if(toupper(gradeAACS1123[a])=='E')<br /><br />scoreAACS1123[CLASS_SIZE]=0.000;<br />else if(toupper(gradeAACS1123[a])=='F')<br /><br />scoreAACS1123[CLASS_SIZE]=0.000;<br /><br />/*============================== Calculate GPA ==============================*/<br />solutionGPA[CLASS_SIZE]=(scoreAACS1084[CLASS_SIZE]+scoreAACS1123[CLASS_SIZE]/(3.000+4.000);<br /><br />totalsolutionGPA+=solutionGPA[CLASS_SIZE];<br /><br />if(solutionGPA[CLASS_SIZE]<lowestGPA){<br />lowestGPA=solutionGPA[CLASS_SIZE];<br />lowGPAstudent=a;<br />}//determine lowest GPA student<br /><br />if(solutionGPA[CLASS_SIZE]>highestGPA){<br />highestGPA=solutionGPA[CLASS_SIZE];<br />highGPAstudent=a;<br />}//determine highest GPA student<br />}//end for loop(from get input grade)<br />//Calculate average total GPA<br />averagetotalGPA=totalsoltionGPA/CLASS_SIZE;<br />/*============================== Display output ==============================*/<br />printf("nttExamination Resultn");<br />printf("Student No.tAACS1084ttAACS1123ttGrade Point Averagen");<br />printf("===========t========tt========tt=== ================n");<br /><br />for(a=1;a<=CLASS_SIZE;a++){<br />printf("%dtt%ctt%ctt%ct%ctt%.3fn",a,gr adeAACS1084[a],gradeAACS1123[a],solutionGPA[CLASS_SIZE]);<br />}<br /><br />printf("nnAVERAGE GPA = %dn",averagetotalGPA);<br />printf("nnHIGHEST GPA = %.3ft obtained by Student No. %d",);<br />printf("nnLOWEST GPA = %.3ft obtained by Student No. %d",lowestGPA,lowGPAstudent);<br />
- AuthorPosts
- The forum ‘C Programming’ is closed to new topics and replies.