Home Forums C Programming Please help me~!! i dunno do

Viewing 1 reply thread
  • Author
    Posts
    • #1953
      nitesh1311
      Participant

      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 7

      Q1.(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

      Student No.     AACS1084        AACS1123        Grade Point Average
      



      1 B C 2.571
      2 D C 1.429
      3
      :
      :
      AVERAGE GPA = … …
      HIGHEST GPA = … … obtained by Student No. …
      LOWEST GPA = … … obtained by Student No. …

      RESULTS ANALYSIS

      A B C D E F total

      AACS1084 4 10 9 9 2 1 35
      AACS1123 3 … … … … … …

      total 7 … … … … … …

      EXAMINATION RESULT NOTIFICATION

      TO:
      MR. STEPHEN CHOW INDEX NO 11234ADIB

      Your examination results are as follows:

      UNIT CODE UNIT TITLE GRADE


      AACS1084 Programming Concepts & Design II B
      AACS1123 Principles of Information Systems C

      GRADE POINT AVERAGE: 2.571

      i nid this by 17 of november >.<

    • #3210
      nitesh1311
      Participant
      #include 
      #include
      DEFINE CLASS_SIZE 4
      void main()
      {
      /*Local Declaration*/
      char gradeAACS1084[CLASS_SIZE],gradeAACS1123[CLASS_SIZE];
      float scoreAACS1084[CLASS_SIZE],scoreAACS1123[CLASS_SIZE] ;
      float solutionGPA[CLASS_SIZE],totalsolutionGPA=0.000;
      float lowestGPA=4.000,highestGPA=0.000;
      int highGPAstudent,lowGPAstudent;
      /*============================== get input grade ==============================*/
      for(a=1;a<=CLASS_SIZE;a++){
      printf("Please Input the score for >n");
      for(a=1;a<=CLASS_SIZE;a++){
      printf("nStudent %dnn",a);
      printf("AACS1084( Programming Concepts & Design II ): ");
      scanf("%c",&gradeAACS1084[a]);
      printf("nn");
      printf("AACS1123( Principles of Information Systems ): ");
      scanf("%c",&gradeAACS1123[a]);
      printf("nn");
      }//Get Grade
      /*============================== Convert PCD2 Score ==============================*/
      for(a=1;a<=CLASS_SIZE;a++){
      if(toupper(gradeAACS1084[a])=='A')
      scoreAACS1084[CLASS_SIZE]=4.000;
      else if(toupper(gradeAACS1084[a])=='B')
      scoreAACS1084[CLASS_SIZE]=3.000;
      else if(toupper(gradeAACS1084[a])=='C')

      scoreAACS1084[CLASS_SIZE]=2.000;
      else if(toupper(gradeAACS1084[a])=='D')

      scoreAACS1084[CLASS_SIZE]=1.000;
      else if(toupper(gradeAACS1084[a])=='E')

      scoreAACS1084[CLASS_SIZE]=0.000;
      else if(toupper(gradeAACS1084[a])=='F')

      scoreAACS1084[CLASS_SIZE]=0.000;
      /*============================== Convert PIS Score ==============================*/
      if(toupper(gradeAACS1123[a])=='A')

      scoreAACS1123[CLASS_SIZE]=4.000;
      else if(toupper(gradeAACS1123[a])=='B')

      scoreAACS1084[CLASS_SIZE]=3.000;
      else if(toupper(gradeAACS1123[a])=='C')

      scoreAACS1123[CLASS_SIZE]=2.000;
      else if(toupper(gradeAACS1123[a])=='D')

      scoreAACS1123[CLASS_SIZE]=1.000;
      else if(toupper(gradeAACS1123[a])=='E')

      scoreAACS1123[CLASS_SIZE]=0.000;
      else if(toupper(gradeAACS1123[a])=='F')

      scoreAACS1123[CLASS_SIZE]=0.000;

      /*============================== Calculate GPA ==============================*/
      solutionGPA[CLASS_SIZE]=(scoreAACS1084[CLASS_SIZE]+scoreAACS1123[CLASS_SIZE]/(3.000+4.000);

      totalsolutionGPA+=solutionGPA[CLASS_SIZE];

      if(solutionGPA[CLASS_SIZE]<lowestGPA){
      lowestGPA=solutionGPA[CLASS_SIZE];
      lowGPAstudent=a;
      }//determine lowest GPA student

      if(solutionGPA[CLASS_SIZE]>highestGPA){
      highestGPA=solutionGPA[CLASS_SIZE];
      highGPAstudent=a;
      }//determine highest GPA student
      }//end for loop(from get input grade)
      //Calculate average total GPA
      averagetotalGPA=totalsoltionGPA/CLASS_SIZE;
      /*============================== Display output ==============================*/
      printf("nttExamination Resultn");
      printf("Student No.tAACS1084ttAACS1123ttGrade Point Averagen");
      printf("===========t========tt========tt=== ================n");

      for(a=1;a<=CLASS_SIZE;a++){
      printf("%dtt%ctt%ctt%ct%ctt%.3fn",a,gr adeAACS1084[a],gradeAACS1123[a],solutionGPA[CLASS_SIZE]);
      }

      printf("nnAVERAGE GPA = %dn",averagetotalGPA);
      printf("nnHIGHEST GPA = %.3ft obtained by Student No. %d",);
      printf("nnLOWEST GPA = %.3ft obtained by Student No. %d",lowestGPA,lowGPAstudent);
Viewing 1 reply thread
  • The forum ‘C Programming’ is closed to new topics and replies.