Programming 1: Examination Analyzer
Posted by JanWan
Last Updated: August 29, 2012
  705

Northern Caribbean University
Department of Computer and Information Sciences
CPTR151 – Programming I

Instructions: Using C++, write the solution for the problem below, save the file as maybe.cpp. Your code MUST be properly commented.
The Maybe High School offers a course that prepares students for tertiary level education. Last year, several students who completed the course matriculated to a tertiary level institution of their choice. Naturally, the college wants to know how well its students did on the exam. You have been asked to write a program to summarize the results.
Your program should:
1. Prompt the user to enter the names and final grades of 10 students. Note: A final grade greater than or equal to 75 is considered a pass otherwise, fail.
2. Count the number of passes and failures
3. Display a summary of the test results indicating the number of students who passed and the number of students who failed.
4. If more than 6 students passed the exam, print the message “Raise the Tuition”, otherwise, “Evaluate Teachers.”
5. The user should be given the opportunity to run the program until X is entered to terminate. The screen should be cleared on each run of the program.

MayBe High School
Examination Analyzer
Enter Name:
Enter Final Grade:

MayBe High School
Examination Analyzer
Summary
Number of Passes: 00
Number of Failure: 00

MayBe High School
Examination Analyzer
Summary
Number of Passes: 00
Number of Failure: 00
DO YOU WANT TO ENTER ANOTHER SET OF STUDENTS?
Press Y to continue and X to terminate
   
  
 
 
   

 
 
working on the code right now!
 
Mi a go home to work on it...
 
it suppose to be written in C++ only
 
Finally the code is finish! Check to see if there is any bug.

#include <iostream>
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
string name[10];
int grade[10];
int fail = 0;
int pass = 0;
char x;
for(;;)
{
system("cls");
cout<<"MayBe High School"<<endl;
     cout<<"Examination Analyzer"<<endl;
     
     for(int i=0;i<10;i++)
     {
      cout<<"Enter Name: ";
        cin>>name[i];
     
      cout<<"Enter Final Grade: ";
      cin>>grade[i];
     
      if(grade[i] >= 75)
      {
      pass++;
      }
      else
      {
      fail++;
      }
     }
     cout<<""<<endl;
  cout<<"MayBe High School"<<endl;
     cout<<"Examination Analyzer"<<endl;
      cout<<""<<endl;
  cout<<"Summary"<<endl;
cout<<"Number of Passes:"<<pass<<endl;
cout<<"Number of Failure:"<<fail<<endl;
cout<<""<<endl;


if(pass > 6)
{
cout<<"Raise the Tuition"<<endl;
}
else
{
cout<<"Evaluate Teachers"<<endl;
}
cout<<""<<endl;
cout<<"DO YOU WANT TO ENTER ANOTHER SET OF STUDENTS?"<<endl;
cout<<"Press Y to continue and X to terminate"<<endl;
cin>>x;
if(x == 'x' || x == 'X')
{
break;
}
else if(x == 'y' || x == 'Y')
{
    fail = 0;
pass = 0;
continue;
}
}
return 0;
}