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
andrew11 [14]
4 years ago
9

The program prompts the user to interactively enter eight batting averages, which the program stores in an array. The program sh

ould then find the minimum and maximum batting average stored in the array as well as the average of the eight batting averages. The data file provided for this lab includes the input statement and some variable declarations. Comments are included in the file to help you write the remainder of the program.
Instructions
Ensure the source code file named BattingAverage.cpp is open in the code editor.
Write the C++ statements as indicated by the comments.
Execute the program by clicking the Run button. Enter the following batting averages: .299, .157, .242, .203, .198, .333, .270, .190. The minimum batting average should be .157, and the maximum batting average should be .333. The average should be .2365
Computers and Technology
1 answer:
puteri [66]4 years ago
7 0

Answer:

The explanation and solution of this question is given below in explanation section. This program is written in c++ using dev C++. This below program run accurately according to requirement of the given question. While explanation of code is commented in the program.

Explanation:

// Example program

#include <iostream>

#include <string>

using namespace std;

int main()

{

 

   double number[8];// user enter eight batting average

   double average=0.0;// average of all 8 batting

   

   for (int i=0; i<8; i++)// prompt user to enter batting average interactively

   {    

       cout<<"Please enter batting average of "<<i<<"\n";

       cin>>number[i];       // store batting average into array

       

   }

   

   double  max = number[0];// maximum average variable declaration

   for (int i = 0; i < 8; i++)//loop to find max average

   {

       if (max < number[i])

           max = number[i];

   }

double min = number[0];//minimum average variable declaration

   for (int i = 0; i < 8; i++)//loop to find minimum average

   {

       if (min > number[i])

           min = number[i];

   }

   cout << "The maximum batting average is : " << max<<"\n";//display maximum average

   cout << "The minimum batting average is : " << min<<"\n";//display minimum average

   

     

       for (int i=0; i<8; i++)//loop to calculate the average

   {    

       

       average=average+number[i];// sum of all averages

       

   }

   average=average/8;//average of eight batting averages

   cout<<"The average is "<<average<<"\n";//display the average

   

 return o;  

}

You might be interested in
Computer designers have concentrated on technology using gallium arsenide instead of silicon because silicon:
cestrela7 [59]

Answer: cannot emit light and has speed limitations

Explanation:

Silicon is usually used in computer chips and solar cells but Gallium arsenide is regarded as a better alternative even though it's costly than silicon.

Gallium arsenide has technical advantages over silicon as its electrons

move through it faster than they move through silicon. Also, cannot emit light and has speed limitations.

Gallium arsenide is used in manufacturing devices like infrared light-emitting diodes, solar cells, optical windows, etc.

7 0
3 years ago
What is the main difference between a struct and a class?
Kay [80]

Explanation:

A class encapsulates methods, while a struct cannot.

4 0
3 years ago
What do both wireless lans (wlans) and wireless wans (wwans) rely on as the communication medium?
AnnyKZ [126]

Wireless lans (WLANS) and wireless wans (wwans) rely on as the radio frequency spectrum communication medium.

<h3>What is Radio spectrum?</h3>

The radio spectrum is known to be an aspect of the electromagnetic spectrum that is said to have frequencies from 0 Hz to 3,000 GHz.

Note that Wireless lans (WLANS) and wireless wans (wwans) rely on as the radio frequency spectrum communication medium for their functions.

Learn more about WLANS from

brainly.com/question/26956118

#SPJ12

4 0
2 years ago
Which of the following was the name of the first generation of cell phone networks?
coldgirl [10]

Answer:

1G

Explanation:

1 'G' as in first generation.

Hope this helped. :)

3 0
4 years ago
When an item in a menu is black, it means that _____.
Lunna [17]
You cannot select it because it is either not able to be done at the time or there was an error.
3 0
4 years ago
Read 2 more answers
Other questions:
  • Which of the following may present a problem for Linux users?
    13·2 answers
  • It is important to avoid using a person’s title in an email to avoid offending him or her.
    9·2 answers
  • A game’s ______ is what contains its directions and calculations; some refer to it as the “engine” that drives the game.
    12·1 answer
  • What are the nicknames for the first generation computers
    8·1 answer
  • Write code to complete PrintFactorial()'s recursive case. Sample output if userVal is 5:5! = 5 * 4 * 3 * 2 * 1 = 120
    8·1 answer
  • Henry has created a software that manages a database of all his music.he wishes to run the software on another computer system t
    5·1 answer
  • Which of the following are TRUE? A function can call another function. As long as the function is defined anywhere in your progr
    14·1 answer
  • PLEASE HELP ASAP
    13·2 answers
  • When using the protection options in Excel 2016, what does the Protect Workbook function do?
    8·2 answers
  • Which symbol should you use for entering a formula in a cell?
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!