C Please Students from computer class attended a testthat ha

C++ Please

Students from computer class attended a testthat had two versions of the exam, A, and B. 15 students received version A, and their scores are implicitly initialized to 52, 86, 95, 23, 78, 89, 52, 81, 97, 45, 35, 84, 75, 94, 26. 8 students received version B, and we don’t know their scores. Hence, ask the user to enter scores for 8 students [ Validation: All scores must be > 10 ] Create two arrays, formA, and formB, and populate them with the scores accordingly. The program must use Arrays and for-loop. Write a program to compute: Version A mean score Version B mean score Mean score, when both version A and B scores are combined Least score, when both version A and B scores are combined Highest score, when both version A and B scores are combined

Expected Output:

Version A scores: _____________________________________________

Version B scores: ____________________________________________

Version A mean score: _____________________

Version B mean score: _____________________

Mean score, when both version A and B scores are combined: _____________________

Least score, when both version A and B scores are combined: _____________________

Highest score, when both version A and B scores are combined: _____________________

Solution

#include <iostream>
using namespace std;

int main()
{
   int formA[15] ={52, 86, 95, 23, 78, 89, 52, 81, 97, 45, 35, 84, 75, 94, 26};
   int formB[8];
   int i,meanA,meanB,least,highest;
  
   cout<<\"\ Enter the scores for formB\";
   for(int i=0;i<8;i++)
   {
   cin>>formB[i]; //input Form B scoores
   if(formB[i]<10)
   cout<<\"Score should be greater than 10\"; //validation
   }
  
  
   meanA =0;
   for(i=0;i<15;i++)
   {
       meanA = meanA +formA[i];
   }
  
  
  
   meanB =0;
   for(i=0;i<8;i++)
   {
       meanB = meanB +formB[i];
   }
  


least =999;
for(i=0;i<15;i++)
{
    if(least > formA[i])
    least = formA[i];
}

for(i=0;i<8;i++)
{
    if(least > formB[i])
    least = formB[i];
}
  

highest =0;
for(i=0;i<15;i++)
{
    if(highest < formA[i])
    highest = formA[i];
}

for(i=0;i<8;i++)
{
    if(highest < formB[i])
    highest = formB[i];
}

cout<<\"\ Version A scores:\";
   for(i=0;i<15;i++)
   {
       cout<<formA[i]<<\"\\t\";
   }
  
   cout<<\"\ Version B scores:\";
   for(i=0;i<8;i++)
   {
       cout<<formB[i]<<\"\\t\";
   }
   meanA=meanA/15; //mean score form A
   cout<<\"\ Version A mean score: \"<<meanA;
   meanB=meanB/8; //mean score form B
   cout<<\"\ Version B mean score: \"<<meanB;
  
   cout<<\"   \ Mean score, when both version A and B scores are combined:\"<<(meanA+meanB)/2;   //combined mean score
   cout<<\"\ Least score, when both version A and B scores are combined:\"<<least; //combined least score
  
cout<<\"\ Highest score, when both version A and B scores are combined:\"<<highest; //combined highest score
   return 0;
}

output:

Success time: 0 memory: 3472 signal:0

C++ Please Students from computer class attended a testthat had two versions of the exam, A, and B. 15 students received version A, and their scores are implici
C++ Please Students from computer class attended a testthat had two versions of the exam, A, and B. 15 students received version A, and their scores are implici

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site