Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function that will read a collection of examination scores ranging in va

ID: 3781207 • Letter: W

Question

Write a function that will read a collection of examination scores ranging in value from 1 to 100. Your subprogram should count and print the number of scores in the outstanding category ( 90 – 100), the number of scores in the satisfactory category ( 60-89), and the number of scores in the unsatisfactory category ( 1-59). The test data for the subprogram is :

63           75           72

72           78           67

80           63           75

90           89           43

59           99           82

12           100

Explanation / Answer

#include <iostream>

using namespace std;
void catagorize(int score[17])
{
   int j=0;     //counters for 3 arrays for 3 categories
   int k=0;
   int l=0;
   int count1,count2,count3;
   int outstanding[17],satisfactory[17],unsatisfactory[17]; //three arrays for 3 categories
   count1=count2=count3=0;
   for(int i=0;i<17;i++)
   {
       if(score[i] >=90 && score[i] <=100)
       {
       outstanding[j] = score[i];
       j++;
       count1++;    //increment count1
       }
       else if(score[i] >=60 && score[i] <=89)
       {
       count2++;    //increment count2 for satisfactory category
       satisfactory[k] = score[i];
       k++;
       }
       else if(score[i] >=1 && score[i] <=59)
       {
      
           count3++;    //increment count for unsatisfactory category
           unsatisfactory[l]= score[i];
           l++;
       }
   }
       //display different caregories of score with counts
       cout<<" Scores in outstanding category : "<<count1<<endl;
       for(j=0;j<count1;j++)
       cout<<outstanding[j]<<" ";
      
       cout<<" Scores in satisfactory category : "<<count2<<endl;
       for(j=0;j<count2;j++)
       cout<<satisfactory[j]<<" ";
      
       cout<<" Scores in unsatisfactor category : "<<count3<<endl;
       for(j=0;j<count3;j++)
       cout<<unsatisfactory[j]<<" ";
  
}

int main() {
   int score[17];
   cout<<"Enter scores ";
   for(int i=0;i<17;i++)
   {
       cin>>score[i];
   }
   catagorize(score);
   return 0;
}

output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote