Revisit previous programming project and create the functions that have the foll
ID: 3769582 • Letter: R
Question
Revisit previous programming project and create the functions that have the following prototypes. Each 20 points and main() 20 points. void getStudName(string & studFirstName, string & studLastName); void getStudExams (float & studExam1, float & studExam2, float & studExam3); float calStudAvg(float studExam1, float studExam2, float studExam3); void displyGrade(string studFirstName, string studLastName, float avg); here is the previous project:: Implement the following Pseudocode (algorithm) in C++ Submit Source and screen capture of run window as a zip file in assignment box. 1. start 2. declare variables 3. print “Enter student first name” 4. input studFirstName 5. print “Enter student last name” 6. input studLastName 7. print “Enter score for exam 1” 8. input studExam1 9. print “Enter score for exam 2” 10. input studExam2 11. print “Enter score for exam 3” 12. input studExam3 13. compute studScore = studExam1 + studExam2 + studExam3 14. compute studAvg = studScore / 3 15. print “Student’s Final Grade” 16. stop
Explanation / Answer
#include<iostream>
#include<string.h>
using namespace std;
void getStudName(string & studFirstName, string & studLastName) {
cout<<"Enter student first name: ";
cin>>studFirstName;
cout<<"Enter student last name: ";
cin>>studLastName;
}
void getStudExams (float & studExam1, float & studExam2, float & studExam3) {
cout<<"Enter score for exam 1: ";
cin>>studExam1;
cout<<"Enter score for exam 2: ";
cin>>studExam2;
cout<<"Enter score for exam 3: ";
cin>>studExam3;
}
float calStudAvg(float studExam1, float studExam2, float studExam3) {
float studScore = studExam1 + studExam2 + studExam3;
float studAvg = studScore / 3.0;
return studAvg;
}
void displyGrade(string studFirstName, string studLastName, float avg) {
cout<<"Student’s Final Grade: ";
cout<<"Name: "<<studFirstName<<" "<<studLastName<<" ";
cout<<"Grade: "<<avg<<" ";
}
int main() {
string studFirstName, studLastName;
float studExam1, studExam2, studExam3;
getStudName(studFirstName, studLastName);
getStudExams(studExam1, studExam2, studExam3);
float studAvg = calStudAvg(studExam1, studExam2, studExam3);
displyGrade(studFirstName, studLastName, studAvg);
cout<<" ";
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.