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”

2
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by Kattalyst

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

# include <iostream>
# include <cmath>

using namespace std;

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

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;
}``````
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.