Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For research purposes and to assist students, the admission office of your local

ID: 3631177 • Letter: F

Question

For research purposes and to assist students, the admission office of your local university
wants to determine the performance of female and male students in certain courses. You
receive a list of input data that consists of female and male student's GPAs for certain
courses. Due to confidentiality, the letter code f is used for female students, m is used for
male students. Every data entry consists of a letter code followed by a GPA. Each line has
one entry. The last line consist of q 0. The number of data is unknown. Draw a flowchart
and write the algorithm that computes and outputs the average GPA for both female and
male students. Finally, write a C++ program and format your results to two decimal places.

Explanation / Answer

//not sure about input, or if formal list, so: stack fstack; stack mstack; while (str != "q 0") { if (str.at(0) == 'f') fstack.push(atoi((str.substr(2)).c_str()); //2 is position of start of integer else //for mstack } while (!fstack.empty()) add up GPA and average it //do same for mstack