1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lorico [155]
3 years ago
7

Write a program that accepts any number of homework scores ranging in value from 0 through 10. Prompt the user for a new value i

f they enter an alphabetic character. Store the values in array. Calculate the average excluding the lowest and highest scores. Display the average as well as the highest and lowest score that were discarded.
Computers and Technology
1 answer:
vazorg [7]3 years ago
8 0

Answer:

This program is written in C++

Note that the average is calculated without the highest and the least value.

Comments are used for explanatory purpose

See attachment for .cpp file.

Program starts here

#include<iostream>

using namespace std;

int main()

{

int num;

cout<<"Enter Number of Test [0-10]: ";

//cin>>num;

while(!(cin>>num) || num > 10|| num<0)

{

cout << "That was invalid. Enter a valid digit: "<<endl;

cin.clear(); // reset the failed input

cin.ignore(123,'\n');//Discard previous input

}

//Declare scores

int scores[num];

//Accept Input

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

{

cout<<"Enter Test Score "<<(i+1)<<": ";

cin>>scores[i];

}

           //Determine highest

           int max = scores[0];

           for (int i = 1; i < num; i++)

           {

               if (scores[i] > max)

               {

                   max = scores[i];

               }

           }

           //Determine Lowest

           int least = scores[0];

           for (int i = 1; i < num; i++)

           {

               if (scores[i] < least)

               {

                   least = scores[i];

               }

           }

           int sum = 0;

           //Calculate total

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

           {

               sum += scores[i];

           }

           //Subtract highest and least values

           sum = sum - least - max;

           //Calculate average

           double average = sum / (num - 2);

           //Print Average

           cout<<"Average = "<<average<<endl;

           //Print Highest

           cout<<"Highest = "<<max<<endl;

           //Print Lowest

           cout<<"Lowest = "<<least;

return 0;  

}

Download cpp
You might be interested in
The numeric keys on the keyboard are sometimes called the ten keypad. true false
mr_godi [17]
The answer is true...
8 0
2 years ago
Read 2 more answers
______are our thoughts and feelings towards a particular subject
ddd [48]
c....attitudes.....
8 0
2 years ago
Select the correct answer from each drop-down menu. Which two factors do ergonomic principles consider a part of a job? Ergonomi
Rudiy27

Answer:mental stress

Explanation:

4 0
3 years ago
What Windows utility can enable you to shut down an unresponsive application?
boyakko [2]

Answer:

Task manager

Explanation:

Allows you to force quit applications.

4 0
2 years ago
Read 2 more answers
Multiply each element in origList with the corresponding value in offsetAmount. Print each product followed by a semicolon (no s
oee [108]

Answer:

Replace /* Your code goes here */  with

for(i =0; i<NUM_VALS; i++) {

    printf("%d", origList[i]*offsetAmount[i]);

printf(";");

}

Explanation:

The first line is an iteration statement iterates from 0 till the last element in origList and offsetAmount

for(i =0; i<NUM_VALS; i++) {

This line calculates and print the product of element in origList and its corresponding element in offsetAmount

    printf("%d", origList[i]*offsetAmount[i]);

This line prints a semicolon after the product has been calculated and printed

printf(";");

Iteration ends here

}

5 0
2 years ago
Other questions:
  • Credibility means that the reader perceives value in what you write.<br> True False
    12·1 answer
  • Organisms are classified as producers or consumers acorrding to the way they
    11·2 answers
  • ________ are websites that provide collections of content from all over the world wide web a. aggregators b. social networks c.
    6·1 answer
  • What is the purpose of a filename extension? How can you restore a file that you deleted from the hard disk?
    10·1 answer
  • What items do you keep in a data base
    5·1 answer
  • HELP PLSSSSS!!! I WILL MARK BRAINLIEST FOR THE FIRST AND CORRECT ANSWER!!!
    14·2 answers
  • Assume that a file contains students' ids, full names, and their scores (Assignments grade, quizzes grade,
    5·1 answer
  • Explain the term game! And give me complete sentences. U can use ur opinion as well!
    11·1 answer
  • In computer science, what is the name for a series of steps used to solve a problem?
    5·1 answer
  • Which of the following describe the characteristics of a good logo? Choose all that apply. It is a complex design It is memorabl
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!