Answer to Question #254294 in C++ for Fisiwe Shezi

Question #254294

The Computer Science Department follows certain criteria when a student learns to program. A number of

programming exercises must be worked through. To proceed to the next exercise a student has to obtain a mark

of 50% or more and must have completed 5 or more program runs. You are requested to write a program to validate

if a student can proceed to the next program.

Your program should have the following structure:

 Declare two integer variables programsDone and result.

 Validate the data captured for the two variables using a while loop.

 The loop should be repeated until the value of result is greater than or equal to 50 and the value of

programsDone is greater than or equal to 5.

 Display a message like "Good! You can now proceed to the next exercise"


1
Expert's answer
2021-10-21T02:20:48-0400
#include <iostream>




using namespace std;






int main()
{
	//Declare two integer variables programsDone and result.
	int programsDone=-1;
	int result=-1;
	//Validate the data captured for the two variables using a while loop.
	//The loop should be repeated until the value of result is greater than or equal to 50 and the value of programsDone is greater than or equal to 5.
	while(result<50){
		cout<<"Enter result >=50: ";
		cin>>result;
	}
	while(programsDone<5){
		cout<<"Enter programsDone >=5: ";
		cin>>programsDone;
	}
	//Display a message like "Good! You can now proceed to the next exercise"
	cout << "Good! You can now proceed to the next exercise"<< endl;


	cin>>result;


	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS