Answer to Question #202390 in C++ for jay

Question #202390

A teacher has stored the percentage scores for eighty-six (86) students; she has the following tasks to complete: • compute and print the average score. • add an additional fourteen percent to each student’s score Write a pseudo-code that will first allow the teacher to enter the initial percentage score for each student, as well as add the 14% to each student’s score. Your solution must then compute and display the average score. Your solution must implement and use an array to store and process the percentage scores. 


1
Expert's answer
2021-06-04T06:10:09-0400
//Pseudo-code to allow the teacher to enter data for each student and then add 14% to each student. And then display the average



//Declare array of size 86
//Use a loop to iterate over the array and allow the teacher / user to input the score of each student
//Declare a variable sum to store the total of all the students' scores
//Create another loop to find the sum
//Outside the loop, divide the sum of elements in array with 86 to find the average score of the students.
//The below code is an implementation of the  pseudocode



#include<iostream>
#include<array>
using namespace std;


int main(){
	array<int, 86> arr;
	cout<<"Enter the scores for 86 students"<<endl;
	for(int i= 0; i<arr.size(); i++){
		cout<<"Score for student "<<i + 1 <<":"<<endl;
		cin>>arr[i];
	}
	double sum = 0.0;
	cout<<"The resulting score of each student after adding 14% to each student"<<endl;
	for(int i=0; i<arr.size(); i++){
		arr[i] = arr[i] + 14;
		cout<<"The number is\t"<<arr[i]<<endl;
		sum += arr[i];
	}
	
	cout<<sum<<endl;
	double average = sum / arr.size();
	cout<<"The average score is "<<average;
}

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog