Question

I need help with this c++ question please

ltls. The program should urt valte. 11. Lowest Score Drop 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 score, store it in a reference param- eter variable, and validate it. This function should be called by main once for each of the five scores to be entered. e e 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 and return the lowest of the five scores passed to it. It should be called by calcAverage, which uses the function to determine which of the five scores to drop. e Input Validation: Do not accept test scores lower than O or higher than 100.

thank you

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Could you plz go this code and let me know if u need any changes in this.Thank You
_________________

#include<iostream>

using namespace std;

//function declarations

double calcAverage(int nos[]);

int findLowest(int nos[]);

int getScore();

int main()

{

// Declaring and initializing an array

int nos[5];

//Getting the inputs entered by the user

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

nos[i] = getScore();

}

//Displaying the average

cout<<"Average of four highest scores :"<< calcAverage(nos)<<endl;

  

return 0;

}

//This function will calculates the average of numbers

double calcAverage(int nos[]) {

int lowest = findLowest(nos);

int sum = 0;

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

sum += nos[i];

}

sum -= lowest;

return ((double) sum / (4));

}

//This function will find the lowest of nos

int findLowest(int nos[]) {

int min = nos[0];

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

if (min > nos[i]) {

min = nos[i];

}

}

return min;

}

//This function will get and return the valid number

int getScore() {

int number;

while (true) {

cout<<"Enter a number :";

cin>>number;

if (number <= 0 || number > 100) {

cout<<"** Invalid.Must be between 1-100 **"<<endl;

} else {

break;

}

}

return number;

}

_____________________

Output:

İ. CAProgram Files (x86)\Dev-CpplMinGW64\binAverageOfNosByLeavingTheLowest.exe Enter a number 89 Enter a number :-43 ** Invalid-Must be between 1-100 Enter a number :23 Enter a number :56 Enter a number :67 Enter a number :76 Average of four highest scores :72 Process exited after 1.23 seconds with return value 0 Press any key to continue . - .

__________Could you plz rate me well.Thank You

Add a comment
Know the answer?
Add Answer to:
I need help with this c++ question please thank you ltls. The program should urt valte....
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
  • Lowest Score Drop In Functions, there can only be one return statement. You can not use...

    Lowest Score Drop In Functions, there can only be one return statement. You can not use an exit or break function. 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 score, store it in a reference parameter variable, and validate it. This function should be called by main once for each of...

  • Using basic c++ write 2 separate codes for this assignment. Program #1 Write a program that...

    Using basic c++ write 2 separate codes for this assignment. Program #1 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 score, store it in the reference parameter variable, and validate it. This function should be called by the main once for each of the five scores to be entered. •...

  • A particular talent composition has 5 judges, each of whom awards a score between 0 and...

    A particular talent composition has 5 judges, each of whom awards a score between 0 and 10 to each performer. Fractional scores, such as 8.3, are allowed. A performer's final score is determined by dropping the lowest and the highest score received, then averaging the 3 remaining scores. Write a program that uses this method to calculate a contestant's score. It should include the following functions: double getJudgeData() should ask the user for a judge's score and validate the score....

  • c plus plus determines which of 5 geographic regions within a major city north south east...

    c plus plus determines which of 5 geographic regions within a major city north south east west and central had the fewest reported traffic accidents last year it should have the following function which are called by main int get NumAccidents is passed the name of a region it asks the user for the number of traffic accidents reported in that region during the last year validates the input then returns it. it should be called once for each city...

  • Write a program that asks the user to enter five test scores. The program should display...

    Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Design the following functions in the program: calcAverage—This function should accept five test scores as arguments and return the average of the scores. determineGrade—This function should accept a test score as an argument and return a letter grade for the score (as a String), based on the following grading scale: Score Letter Grade...

  • c++ Instructions Overview In this programming challenge you will create a program to handle student test...

    c++ Instructions Overview In this programming challenge you will create a program to handle student test scores.  You will have three tasks to complete in this challenge. Instructions Task 1 Write a program that allocates an array large enough to hold 5 student test scores. Once all the scores are entered, the array should be passed to a function that sorts them in ascending order. Another function should be called that calculates the average score. The program should display the...

  • Please Write in C++ (10-30) @ 11:55pm 1.9 HW7 This homework assignment gives you the opportunity...

    Please Write in C++ (10-30) @ 11:55pm 1.9 HW7 This homework assignment gives you the opportunity to practice functions, functions that call other functions, reference variables, logical statements (what is meant by logical statement is a statement such as if, if/else if, switch), and input validation, HW7 (Graded out of 100) A talent competition has 5 judges, each of whom awards a score between 0 and 10 for each performer. Fractional scores, such as 8.3, are allowed. A performer's final...

  • read it carefully C++ Question: Write a program that dynamically allocates an array large enough to...

    read it carefully C++ Question: Write a program that dynamically allocates an array large enough to hold a user-defined number of test scores. Once all the scores are entered, the array should be passed to a function that sorts them in ascending order. Another function should be called that calculates the average score. The program should display the sorted list of scores and averages with appropriate headings. Use pointer notation rather than array notation whenever possible. Input Validation: Do not...

  • Write a program that dynamically allocates an array in the freestore large enough to hold a...

    Write a program that dynamically allocates an array in the freestore large enough to hold a user defined number of test scores as doubles. Once all the scores are entered, the array should be passed to a function that finds the highest score. Another function the array should be passed to a function that finds the lowest score. Another function should be called that calculates the average score. The program should show the highest, lowest and average scores. Must use...

  • Write a program that dynamically allocates an array in the freestore large enough to hold a...

    Write a program that dynamically allocates an array in the freestore large enough to hold a user defined number of test scores as doubles. Once all the scores are entered, the array should be passed to a function that finds the highest score. Another function the array should be passed to a function that finds the lowest score. Another function should be called that calculates the average score. The program should show the highest, lowest and average scores. Must use...

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