Question

write a program that uses a function to read in the grades for four classes and...

write a program that uses a function to read in the grades for four classes and then uses a function to calculate the average grade in each of the classes. input the grades for one student. we will name her Beverly. output how Beverly's grade differs from each classe average. Make sure that your output is very clear. Below is your data:
English 90 70 85 45 95 95 82 97 99 65
History 63 94 60 76 83 98 97 55 88 97
C++ 92 83 64 87 93 99 95 84 77 62
Math 65 73 80 90 88 78 62 97 60 72

Beverly's Grades
English 82
History 77
C++ 88
Math 65

it is similar to chapter 5 project( absolute C++ pge 235 #1)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

//code for the above problem:


#include <bits/stdc++.h>

using namespace std;
void Takeinput(int subject[],int n)
{
int i;
for(i=0;i<n;i++)
{
cin>>subject[i];
}
}

int findaverage(int subject[],int n)
{
int i,sum;
sum=0;
for(i=0;i<n;i++)
{
sum=sum+subject[i];
}
  
return sum/n;
}

int main()
{
int n;
cout<<"enter the number of attempts:";
cin>>n;
int English[n],History[n],Cpp[n],Math[n];
cout<<"English ";
Takeinput(English,n);
cout<<"History ";
Takeinput(History,n);
cout<<"C++ ";
Takeinput(Cpp,n);
cout<<"Math";
Takeinput(Math,n);
cout<<"Beverly's Grades"<<endl;
  
cout<<"English "<<findaverage(English,n)<<endl;
cout<<"History "<<findaverage(History,n)<<endl;
cout<<"C++ "<<findaverage(Cpp,n)<<endl;
cout<<"Math "<<findaverage(Math,n)<<endl;

return 0;
}


//If you have any queries ,please ask in the comment section

//If you ot the answer,please upvote:)

Add a comment
Know the answer?
Add Answer to:
write a program that uses a function to read in the grades for four classes and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please help me with this program.You are to write a C++ program that will read in...

    Please help me with this program.You are to write a C++ program that will read in up to 15 students with student information and grades. Your program will compute an average and print out certain reports. Format: The information for each student is on separate lines of input. The first data will be the student�s ID number, next line is the students name, next the students classification, and the last line are the 10 grades where the last grade is...

  • Microsoft Excel Question. I'm having trouble using the vlookup function, I have calculated a final numerical...

    Microsoft Excel Question. I'm having trouble using the vlookup function, I have calculated a final numerical grade for a hypothetical course, and and trying to use a set of numerical grades with their corresponding letter grades to get a vlookup function to return the letter grade from the numerical grade. However the function for some reason only returns the lowest value out of the set grades, not the closest match. Projects Classwork Teamwork/Integrity 100 100 A+ 98 A+ 97 A...

  • Write a program to calculate students’ average test scores and their grades. You may assume the...

    Write a program to calculate students’ average test scores and their grades. You may assume the following data: Johnson 85 83 77 91 76 Aniston 80 90 95 93 48 Cooper 78 81 11 90 73 Gupta 92 83 30 69 87 Blair 23 45 96 38 59 Clark 60 85 45 39 67 Kennedy 77 31 52 74 83 Bronson 93 94 89 77 97 Sunny 79 85 28 93 82 Smith 85 72 49 75 63 Use three...

  • Write a program to calculate students’ average test scores and their grades. You may assume the...

    Write a program to calculate students’ average test scores and their grades. You may assume the following data: Johnson 85 83 77 91 76 Aniston 80 90 95 93 48 Cooper 78 81 11 90 73 Gupta 92 83 30 69 87 Blair 23 45 96 38 59 Clark 60 85 45 39 67 Kennedy 77 31 52 74 83 Bronson 93 94 89 77 97 Sunny 79 85 28 93 82 Smith 85 72 49 75 63 Use three...

  • C++: Create a grade book program that includes a class of up to 20 students each...

    C++: Create a grade book program that includes a class of up to 20 students each with 5 test grades (4 tests plus a Final). The sample gradebook input file (CSCI1306.txt) is attached. The students’ grades should be kept in an array. Once all students and their test scores are read in, calculate each student’s average (4 tests plus Final counts double) and letter grade for the class. The output of this program is a tabular grade report that is...

  • Student average array program

    Having a bit of trouble in my c++ class, was wondering if anyone can help.Write a program to calculate students' average test scores and their grades. You may assume the following input data:Johnson 85 83 77 91 76Aniston 80 90 95 93 48Cooper 78 81 11 90 73Gupta 92 83 30 68 87Blair 23 45 96 38 59Clark 60 85 45 39 67Kennedy 77 31 52 74 83Bronson 93 94 89 77 97Sunny 79 85 28 93 82Smith 85 72...

  • Javascript Problem: Using the data set as a pre-defined variable in your program, write code that...

    Javascript Problem: Using the data set as a pre-defined variable in your program, write code that uses the dataset to print the first names of people with above average math grades and below average age from the dataset. Requirements: Cannot use any built-ins except filter(), map(), and reduce(). Apply higher-order functions to your solution. Dataset: var dataSet = [ { "name": "Maura Glass", "age": 60, "math": 97, "english": 63, "yearsOfEducation": 4 }, { "name": "James Gates", "age": 55, "math": 72,...

  • 5. Mark’s class just took the admission test for business school and averaged 87.05. Chapter 10...

    5. Mark’s class just took the admission test for business school and averaged 87.05. Chapter 10 Data Set 2 contains the population of scores for the 10 other classes in Mark’s university. How did Mark’s class do? Class 1 Class 2 Class 3 Class 4 Class 5 Class 6 Class 7 Class 8 Class 9 Class 10 78 81 96 85 88 78 90 79 96 86 77 78 97 90 88 82 86 93 87 89 78 93 88...

  • Student stress at final exam time comes partly from the uncertainty of grades and the consequence...

    Student stress at final exam time comes partly from the uncertainty of grades and the consequences of those grades. Can knowledge of a midterm grade be used to predict a final exam grade? A random sample of 200 BCOM students from recent years was taken and their percentage grades on assignments, midterm exam, and final exam were recorded. Let’s examine the ability of midterm and assignment grades to predict final exam grades. The data are shown here: Assignment Midterm FinalExam...

  • Consider the below matrixA, which you can copy and paste directly into Matlab.

    Problem #1: Consider the below matrix A, which you can copy and paste directly into Matlab. The matrix contains 3 columns. The first column consists of Test #1 marks, the second column is Test # 2 marks, and the third column is final exam marks for a large linear algebra course. Each row represents a particular student.A = [36 45 75 81 59 73 77 73 73 65 72 78 65 55 83 73 57 78 84 31 60 83...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT