Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using c++, how can i get all example outputs with variations of the code added below the images. #include #include using namespace std; int getNumberOfStudents(){

Using c++, how can i get all "example outputs" with variations of the code added below the images.

image text in transcribedimage text in transcribedimage text in transcribed

#include

#include

using namespace std;

int getNumberOfStudents(){

double n;

while(true){

cout

cout

cin >> n;

cin.clear();

cin.ignore(100,' ');

if ( !int(n) || n != int(n) || n

cout

cin.clear();

cin.ignore(100,' ');

}

else if (n

cout

cout

cout

cin.clear();

cin.ignore(100,' ');

}

else{

return n;

}}}

void initialize(int &countGradeA, int &countGradeB, int &countGradeC, int &countGradeD, int &countGradeF){

countGradeA = 0;

countGradeB = 0;

countGradeC = 0;

countGradeD = 0;

countGradeF = 0;

}

void classifyGrade(double grade, int &countGradeA, int &countGradeB, int &countGradeC, int &countGradeD, int &countGradeF){

if (grade >= 90)

countGradeA++;

else if (grade >= 80)

countGradeB++;

else if (grade >= 70)

countGradeC++;

else if (grade >= 60)

countGradeD++;

else if (grade

countGradeF++;

}

void printResults(int countGradeA, int countGradeB, int countGradeC, int countGradeD, int countGradeF){

cout

cout

cout

cout

cout

cout

cout

cout

cout

}

void getNumberGrade(int& grade)

{

while(true)

{

cout

cin >> grade;

cin.clear();

cin.ignore(100,' ');

if ( !int(grade) || grade!=int(grade) || grade = 101 ){

cout

}

else

break;

}

}

int main(){

int grade;

int countGradeA, countGradeB, countGradeC, countGradeD, countGradeF;

initialize(countGradeA, countGradeB, countGradeC, countGradeD, countGradeF);

double n = getNumberOfStudents();

for (int i = 0; i

getNumberGrade(grade);

classifyGrade(grade,countGradeA, countGradeB, countGradeC, countGradeD, countGradeF);

}

printResults(countGradeA, countGradeB, countGradeC, countGradeD, countGradeF);

return 0;

}

Project 2 - Using Functions (6 pts) Student Grade Statics Define and use functions to determine the number of letter grades from a given list of students' number grades. The requirements are - 1) Initialize the variables, countGradeA, countGradeB, countGradec, countgradeD, countgrade F to 0 . 2) Validate if the input data is an integer number. In other words, if any non-digit character or a non-integer number is entered, the program will print out an error message and prompt to re-enter the number. 3) Read in the number of students. Validate the input data for the number of students in the class by calling the function defined in 2). 4) Read a number grade. Validate the input data for the number grade by calling the function defined in 2). Validate if the grade falls in the range of 0-100. If the number grade is in between 10090, for example, then increment the countgradeA count and so on and so forth for all other grades. Letter grades are determined by the following - 90100808970796069059ABCDE 5) Repeat steps 2 and 3 for each number in the list. 6) Print out the results which shows the counts for each grade. The following functions should be defined/implemented and called in main() int getNumberofstudents(); // make sure to validate number of students int getValidintegerinput(string mag); // validate input data void Initialize(int\& countgradeA, int\& countGradeB, ints countGradec, inte countgraded, inta countGradef;; //initialize all the grades void getNumberGrade(ints grade); // make sure to valid the grade void classifyGrades (int grade, ints countGradeA, ints countGradeB, inti countgradec, int\& countgradeD, inte countgradef); void printResultsint countGradeA, int countGradeB, int countGradec, int countGradeD, int countGradeF); Example output: Example output: Example output: ElET575YProjectsigradingfunctions.exe GRADE STAIISTICS Please enter nupber of students: ABC Invalid input. Please re-enter an integer nunber. Please enter nunber of students:? Invalid input. Please re-enter an integer nunber. Please enter nunber of students: 1 Invalid input. Please re-enter. Please enter nunber of students: 1.1 Invalid input. Please re-enter an integer nunber. Please enter nunber of students: 3 Please enter an integer grade between B and 106: ABC Invalid input. Please re-enter an integer nuaber. Please enter an integer grade between g and 100: ? Invalid input. Please re-enter an integer nunber. Please enter an integer grade between and 100:1 Invalid grade? Please re-enter. Please enter an integer grade between and 100:111 Invalid grade? Please re-enter. Please enter an integer grade between and 100:1.1 Invalid input. Please re-enter an integer nunber. Please enter an integer grade between and 106:?7 Please enter an integer grade between B and 100:88 Please enter an integer grade between and 100: 99<>

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

Sell the quality of your brand or products.

Answered: 1 week ago

Question

describe the functions of strikes.

Answered: 1 week ago

Question

Psychological, financial, and career counseling.

Answered: 1 week ago