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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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