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

Write a function that will compute the average of a specific grade type. This fu

ID: 3817316 • Letter: W

Question

Write a function that will compute the average of a specific grade type. This function will have five parameters passed by value and return the average.
Array of scores
Array of grade types
Array of the max points per score
Size of the arrays
Grade type

Help please I am not sure how to write this out this is my code its c++

#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <ctime>

#include <math.h>

#include <fstream>

using namespace std;

//pass in the parameters

char letter_grade(double score) {

char limit[][4] = { 90,80,70,60,'A','B','C','D' };

for (int i = 0; i < 4; i++) {

if (score >= limit[0][i])

return limit[1][i];

}

return 'F';

}

void inputData(double score[], int type[], int max[], int& size) {

//open the input file

ifstream intput("X:\Downloads\lab4input.txt");

if (intput)

{

cout << "quizz grades my guy " << endl;

}

//In the while condition, add the instream variable

while (intput >> score[size] >> type[size] >> max[size])

{

size++;

}

//clsoe the file

intput.close();

}

int main() {

//Array to store the scores

double score[50];

//Array to store the types

int type[50];

//Array to store the max points

int max[50];

//Size

int size = 0;

inputData(score, type, max, size);

for (int i = 0; i < size; i++) {

if (score[i] == 1)

{

score[i];

}

}

for (int i = 0; i < size; i++) {

if (type[i] == 1)

{

type[i];

}for (int i = 0; i < size; i++) {

if (max[i] == 1) {

max[i];

}

cout << "quiz " << type[i] << endl;

cout << "max " << max[i] << endl;

cout << "score " << score[i] << endl;

}

system(" pause");

return 0;

}

Explanation / Answer

#include <iostream>

#include <cstdio>

#include <cstdlib>

#include <ctime>

#include <math.h>

#include <fstream>

using namespace std;

//pass in the parameters

char letter_grade(double score) {

char limit[][4] = { 90,80,70,60,'A','B','C','D' };

for (int i = 0; i < 4; i++) {

if (score >= limit[0][i])

return limit[1][i];

}

return 'F';

}

void inputData(double score[], int type[], int max[], int& size) {

//open the input file

ifstream intput("X:\Downloads\lab4input.txt");

if (intput)

{

cout << "quizz grades my guy " << endl;

}

//In the while condition, add the instream variable

while (intput >> score[size] >> type[size] >> max[size])

{

size++;

}

//clsoe the file

intput.close();

}

int main() {

//Array to store the scores

double score[50];

//Array to store the types

int type[50];

//Array to store the max points

int max[50];

//Size

int size = 0;

inputData(score, type, max, size);

for (int i = 0; i < size; i++) {

if (score[i] == 1)

{

score[i];

}

}

for (int i = 0; i < size; i++) {

if (type[i] == 1)

{

type[i];

}for (int i = 0; i < size; i++) {

if (max[i] == 1) {

max[i];

}

cout << "quiz " << type[i] << endl;

cout << "max " << max[i] << endl;

cout << "score " << score[i] << endl;

}

system(" pause");

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