98 939
Assignments Done
98.8%
Successfully Done
In May 2021

# Answer to Question #50221 in C++ for John

Question #50221
Write a program that can enter marks for number of students and calculate their Total and class
average with the following format

The inputs:
ID (As 1 dimension array of Integers),marks(as 2 dimensional array of double), Grad (As 1 dimension
array of Chars)
The Grades are: A for 90’s, B for 80’s, C for 70’s, D for 60’s and F for less than 60.

Use the following functions to find
1. void inputID(int[]);
2. void inputMarks(double [][4]);
3. void Total(double[][4]);
5. double ClassAverage(double[][4]);
6. void print(int[],double[][4],char[]);

The output:
St_Nm ID First Second Final Total Grade
1 20071156 15.5 16.5 30.1 62.1 D
2 20071154 15.0 16.5 30.1 62.6 D

Class average for 10 students is: 72.5
1
2015-01-06T00:58:14-0500
#include <iostream>
using namespace std;
//prototype of functions
void inputID(int[]);
void inputMarks(double [][4]);
void Total(double[][4]);
double ClassAverage(double[][4]);
void print(int[],double[][4],char[]);
//main method
int main()
{
//The inputs:
//ID (As 1 dimension array of Integers),marks(as 2 dimensional array of double), Grad (As 1 dimension array of Chars)
int IDs[10];
double marks[10][4];
inputID(IDs);
inputMarks(marks);
Total(marks);
//delay
system("pause");
return 0;
}
//input ID
void inputID(int IDs[]){
for(int i=0;i<10;i++){
cout<<"Enter id for student["<<(i+1)<<"]: ";
cin>>IDs[i];
}
}
//input Marks
void inputMarks(double marks[10][4]){
for(int i=0;i<10;i++){
for(int j=0;j<3;j++){
cout<<"Enter mark "<<(j+1)<<" for student["<<(i+1)<<"]: ";
cin>>marks[i][j];
}
cout<<"\n";
}
}
//Total
void Total(double marks[10][4]){
for(int i=0;i<10;i++){
double total=0;
for(int j=0;j<3;j++){
total+=marks[i][j];
}
marks[i][3]=total;
}
}
for(int i=0;i<10;i++){
double total=marks[i][3];
//The Grades are: A for 90’s, B for 80’s, C for 70’s, D for 60’s and F for less than 60.
if(total>=90){
}
if(total>=80 && total<90){
}
if(total>=70 && total<80){
}
if(total>=60 && total<70){
}
if(total<60){
}
}
}
//calucltae Class Average
double ClassAverage(double marks[][4]){
double total=0;
for(int i=0;i<10;i++){
for(int j=0;j<3;j++){
total+=marks[i][j];
}
}
}
//print
cout<<"St_Nm ID First Second Final Total Grade\n";
//print result
for(int i=0;i<10;i++){
}
cout<<"\nClass average for 10 students is: "<<ClassAverage(marks)<<"\n";
}
﻿

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!