Calculate the average of a group of test scores

Assignment Help Computer Engineering
Reference no: EM132208496

Question :

Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions.

Void getscore() should ask the user for a test scores, store it in a reference parameter variable and validate it. This function should be called by main once for each of the five scores to be entered.

Void calcAverage() should calculate and display the average of the four highest scores. This function should be called just once by main, and should be passed the five scores.

Int findLowest() should find the lowest of the five test scores passed to it. It should be called be calcAverage, which uses the function to determine one of the five scores to drop.

Do not accept scores less than 0 or higher than 100.

Below is what I have:

#include

using namespace std;

const int n=5;

int score[5];

void getscore()

{

cout << "Enter scores:\n";

for (int i = 0; i < n; i++)

{

cin >> score[i];

while(score[i]<0 || score[i]>100)

{

cout<<"\n***incorrect entry\n\n";

cin>>score[i];

}

}

}

int findLowest()

{

int small = 101;

for (int i = 0; i < n; i++)

{

small = score[i] < small ? score[i] : small;

}

return small;

}

void calcAverage ()

{

int lowest=findLowest();

double average = 0;

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

average += score[i];

}

average -= lowest;

average /= 4;

cout << "\nAverage of the four highest scores are: " << average << endl;

}

int main()

{

getscore ();

calcAverage ();

return 0;

}

Reference no: EM132208496

Questions Cloud

Utilize a fraction struct that has a numerator : Make an overloaded operator > that can compare two Fractions and determine whether the first one is greater than the second one.
Calculate and display the average number of days a company : Write a program that calculates and displays the average number of days a company's employees are absent.
Read a string of at least 20 characters from an input file : Write a program in c++ that reads a string of at least 20 characters from an input file. The input file has several lines of such strings.
Write a program called split in java that reads a text file : Write a program called Split in Java that reads a text file, in.txt, that contains a list of positive integers.
Calculate the average of a group of test scores : Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped.
Print all ratings and the average rating in a button event : Write a program in C# Windows Form that creates a ProfessorRating class consisting of professor ID and three ratings.
Write the reference where you get the information : Analyze the repercussions that the two world wars had on the global society and the US and PR. Remember to write the reference where you get this information.
Write a program in c that simulates a soft drink machine : Each time a program runs, it should load the data from the file and enter into a loop that displays the list of drinks and their cost on the screen.
Write the function using a loop and without a loop : Add a main to each of the two programs to fully test them out and do at least 5 test run for each program.

Reviews

Write a Review

Computer Engineering Questions & Answers

  The control process can be replaced with proper standards

Do you agree or disagree with this view? Provide reasoning for your view.

  How many page faults would occur for the lru fifo and lfu

How many page faults would occur for the LRU, FIFO, LFU and optimal page replacement algorithms assuming three and five frames?

  Explain how to locate and recover graphics files

Explain how to locate and recover graphics files. Describe how to identify unknown file formats. Locate hidden evidence through steganography.

  What is maximum number of characters that will change

What is the maximum number of characters that will he changed in the cipher next if only a single character is changed in the plaintext?

  What were the design goals of the tera computer

What were the design goals of the Tera computer? Explain the sparse 3D torus used in Tera. What are the advantages of the sparse structure?

  Create receipt class that could used by an automobile store

Create a Receipt class that could be used by an automobile parts store. Items to include as data members are receipt number, date of purchase, customer number,

  Write program that transform number into corresponding month

Write a program that transforms numbers 1, 2, 3, ..., 12 into the corresponding month names January, February, March, ..., December.

  Create the systems integration project proposal shell

Following is an outline for the comprehensive design proposal that will evolve throughout the course. This deliverable will be created in incremental steps.

  Write an algorithm using pseudocode

Write an algorithm, using pseudocode, to make the robot: stand up walk forward until it senses a wall turn around walk back to the chair sit down in its original starting position Finally, output the total number of steps taken.

  Creating robust interaction and dialogue

The Discussion Board (DB) is part of the core of online learning. Classroom discussion in an online environment requires the active participation of students.

  Write a program that asks for two numbers interactively

Write a program that asks for 2 numbers interactively, when the user input non- number, it will report an error and ask user to input.

  Count the number of negative integers

Write an assembly procedure that reads a string of word size signed integers that ends with a "*".

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd