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

Using c++ QUESTION 2: (40) Suppose we want to compile a student academic report

ID: 3749917 • Letter: U

Question

Using c++

QUESTION 2: (40) Suppose we want to compile a student academic report for a high school learner in grade 12 (matric) A matric learner is enrolled for 6 study units (subjects), namely: English, Mathematics, Life Orientation, History, Computer literacy, Geography. The learner has to pass at least four subjects, including English, to complete grade 12. The subject pass mark is 50%. Write a program that prompts the learner to key in their marks for each subject. The program should include the following functions: a. A function studentDetails, that prompts the learner to key in their personal details name, surname, and schoolName. A function getMarks, that prompts the learner to key in a mark for each of the six subjects, and validate the marks. Do not accept marks lower than 0 or higher than 100. b. c. A function calcAverageYearMark, to calculate and display the average of the 6 Subjects. This function should be called just once by main, and should be passed the 6 Subject marks. (6) A function minMax, to find and return the lowest and the highest of the 6 subject marks passed to it as the subject with the lowest mark; d.

Explanation / Answer

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;

int eng, math, life, hist, comp, art;
string name,surname,schoolName;

void studentDetails(){
cout<<"Please key in your name:"<<endl;
cin>>name>>surname;
cout<<"Please key in the name of your School:"<<endl;
cin>>schoolName;
}

void getMarks(){
cout<<"Key in your marks for English:";
cin>>eng;
cout<<"Key in your marks for Mathematics:";
cin>>math;
cout<<"Key in your marks for Life Orientation:";
cin>>life;
cout<<"Key in your marks for History:";
cin>>hist;
cout<<"Key in your marks for Computer Literacy:";
cin>>comp;
cout<<"Key in your marks for Art:";
cin>>art;
}

void calAverageYearMark(int eng, int math, int life, int hist, int comp, int art){
int sum = eng + math + life + hist + comp + art;
cout<<"Average Year Marks :"<<(sum/6)<<endl;
}

struct min_max{ //Structure to store Min and Max marks
int min;
int max;
};
min_max minMax(){
vector<int> marks; //store marks in vector to sort easily
marks.push_back(eng);
marks.push_back(math);
marks.push_back(life);
marks.push_back(hist);
marks.push_back(comp);
marks.push_back(art);

min_max temp; //temporary variable to store min, max marks

sort(marks.begin(), marks.end()); //sort the sequence to obtain min, max
temp.min = marks[0];
temp.max = marks[5];

return temp;
}

int main(){
studentDetails();
getMarks();
calAverageYearMark( eng, math, life, hist, comp, art);
min_max var = minMax();
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote