A College offers a course that prepares students for the state licensing exam for real estate brokers. Last Year, several of the students who completed this course took the licensing examination. 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. You have been given a list of these 10 students. Next to each name is written a 1 if the student passed the exam or a 2 if the student failed.

Your program should analyze the results of the exam as follows.

1. Input each test result (i.e., a 1 or a 2). Display the message “Enter result” on the screen each time the program requests another test result.

2. Count the number of test results of each type

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 8 students passed the exam, print the message “ Raise tuition”

Recommended Answers

All 4 Replies

Good day..you're going to have to show some effort...we don't do assignments for students...you must show some effort. But a few things:
1. To display the "Enter Result" on the screen each time, you woukd use something like this:

char again = 'y';
while (again =='y')
{
//do something
}
cout<<"Go again?(y/n):"<<endl;
cout<<"Enter Result"<<endl;

2. You use a counter to keep track of which students failed and passed.
3. To check if more than 8 students the exam, you use an if/else statement:

if (numpassed>8)
{
cout<<"Raise tuition"<<endl;

Hope this helps, but you still got ways to go!

Thanks So Much...I had some lines of code already but i just needed a way to implement the loops. This is actually a practice program for an exam. Thanks..You saved a life..

Happy that i could help...in the future you could post your code, so that it could benefit the entire daniweb community!

Here's the finished program...it compiled and ran like RoadRunner..I used Dev C++ as my compiler.

//Created by Kattalyst
//2/12/07
//This Program Calculates Grades

# include <iostream>
# include <cmath>


using namespace std;

int main()
{
const int again = 10;
int result, totalGrade;
int fail=0,counta=0,count = 1;

cout<<"Welcome To Grade Score"<<endl;

do{
cout<<"Enter Result: ";
cin>>result;
count++;

if (result==1)
{
               counta++;
}
else 
{              
                fail++;
}


}while (count <= again);

cout<<endl;
cout<<"Number of Students passed = "<<counta;
cout<<endl;

cout<<"Number of Students Failed = "<<fail<<endl;

if (counta>8)
{
cout<<"Raise tuition"<<endl;
}
else 
{
cout<<"Do not Raise Tuition"<<endl;
}


system ("pause");
return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.