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
Which programming languages are the best choices for desktop applications? Select 3 options.
slega [8]
The three are Python c and html
5 0
3 years ago
Read 2 more answers
The _____ feature will allow users to view nonprinting formatting marks to aid in editing a document. View Alignment Show/Hide I
Annette [7]

The __Show/Hide Insert___ feature will allow users to view non printing formatting marks to aid in editing a document.

The answer is D. Show/Hide Insert

Let me know if this is correct

5 0
3 years ago
Trish has bought a new computer, which she plans to start working on after a week. Since Trish has not used computers in the pas
Nikolay [14]

Answer:

The answer is C

Explanation

She should sign an annual maintenance contract (AMC) with her vendor

3 0
3 years ago
Read 2 more answers
A window may be resized by dragging the___ or side of it
dangina [55]

top i believe is the answer


4 0
3 years ago
Read 2 more answers
Please help me. It's due in 2 hours.
Neporo4naja [7]
1d 2b 3c 4a 5e 6f 7g
3 0
3 years ago
Other questions:
  • There are n tasks to complete. Each task first needs to be preprocessed on a supercomputer and then finished on one of n process
    12·1 answer
  • Want is the assignmment
    8·1 answer
  • Search engines enable you to
    13·2 answers
  • 1. Zack sees an online contest. He could win $10,000 instantly! On the sign-up form, he enters his name and email address. He is
    15·1 answer
  • <img src="https://tex.z-dn.net/?f=6.372%20%5Ctimes%2075%20find%20the%20product" id="TexFormula1" title="6.372 \times 75 find the
    6·1 answer
  • Write a class called TextProcessor that implements the methods listed below. Your implementation may use the charAt() and length
    14·1 answer
  • What does input allow a computer to do
    14·1 answer
  • Helpppppppppppppppppppppppppppppppp
    13·2 answers
  • PLEASE PLEASE PLEASE PLEASE help me Im completly lost will give brainliest and 50 points
    8·2 answers
  • You are reviewing a friend’s HTML project. You notice that the only metadata is the title. Furthermore, you ask your friend abou
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!