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

Help with c++ A professor has constructed a 4-by-4 two-dimensional array of floa

ID: 3684107 • Letter: H

Question

Help with c++ A professor has constructed a 4-by-4 two-dimensional array of float numbers. This array currently contains the lab grades, quiz grades and exam grades of four students in the professor's class. Write a C++ program that calculate the final grade for each student and save it to the last column. You program should display the following output: The final grade consists of 50% lab grade, 20% quiz grade and 30% exam. For example, if lab grade is 90, quiz grade is 80 and exam grade is 85, the final grade is equal to 90 * 0.5 + 80 * 0.3. Use random numbers between 40 and 100 for lab, quiz and exam grades.

Explanation / Answer

#include <iostream>

using namespace std;
class grade
{
double array[4][4]={{42.6, 55.7,67.8,0.0},
{44.5,67.8,89.3,0.0},
{76.8,76.5,56.7,0.0},
{55.5,67.4,78.9,0.0}};
int i,j,k,l;
public:
void calculate()
{
for(int count=0;count<4;count++)
{
array[count][3]=(array[count][0]*0.5)+(array[count][1]*0.2)+(array[count][2]*0.3);
//cout<<array[count][3];
}
for(int m=0;m<4;m++)
for(int n=0;n<4;n++)
cout<<" "<<array[m][n];
cout<<" ";
}
};
int main()
{
grade g1;
g1.calculate();
return 0;
}

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