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]
3 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]3 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
Which writing format is also beneficial to public speaking? a. Five paragraph essay c. Conventions b. Prose d. None of these
garri49 [273]
convention writing is beneficial to public speaking because writing conventions such as spelling,punctuation,capitalization and grammar help make a student content clear and understandable audience can finish reading without having to stop to try to figure out what was actually intended,the value of learning these writing becomes clear.<span />
4 0
3 years ago
Read 2 more answers
What mistake might you make related to changing the data in a cell that's used in a formula?
scoundrel [369]

Answer:

ojalat sirve

Explanation:

Cuando en una fórmula, en vez de indicar una celda, fila o columna estamos enlazando una hoja de cálculo o libro, debemos hacerlo con comilla simple. Si empleamos otro signo o símbolo separador, la fórmula no entenderá correctamente lo que le estamos indicando.

6 0
3 years ago
Which of the following problems is least likely to be solved through grid computing? Financial risk modeling Gene analysis Linea
gregori [183]

Answer:

Linear problems

Explanation:Grid computing is the term used in Information technology, Computer programming and Computer networks to describe the interconnection of different Computer resources in order to achieve certain specified goal. GRID COMPUTING ALLOWS COMPUTER RESOURCES TO WOK AS A SINGLE UNIT.

Grid computing can be used to solve various issues connected with the use of Computer resources such as Financial risk modelling,Gene analysis etc but least likely to be used to solve Linear problems.

6 0
3 years ago
Complete the do-while loop to output every number form 0 to countLimit using printVal. Assume the user will only input a positiv
elena-s [515]

Answer:

PART ONE

  1. import java.util.Scanner;
  2. public class CountToLimit {
  3.    public static void main(String[] args) {
  4.        Scanner scnr = new Scanner(System.in);
  5.        int countLimit = 0;
  6.        int printVal = 0;
  7.        // Get user input
  8.        System.out.println("Enter Count Limit");
  9.        countLimit = scnr.nextInt();
  10.        do {
  11.            System.out.print(printVal + " ");
  12.            printVal = printVal + 1;
  13.        } while ( printVal<=countLimit );
  14.        System.out.println("");
  15.        return;
  16.    }
  17. }

PART TWO

  1. import java.util.Scanner;
  2. public class NumberPrompt {
  3.    public static void main (String [] args) {
  4.        Scanner scnr = new Scanner(System.in);
  5.        System.out.print("Your number < 100: ");
  6.       int  userInput = scnr.nextInt();
  7.      do {
  8.           System.out.print("Your number < 100: ");
  9.           userInput = scnr.nextInt();
  10.       }while (userInput>=100);
  11.        System.out.println("Your number < 100 is: " + userInput);
  12.        return;
  13.    }
  14. }

Explanation:

In Part one of the question, The condition for the do...while loop had to be stated this is stated on line 14

In part 2, A do....while loop that will repeatedly prompt user to enter a number less than 100 is created. from line 7 to line 10

7 0
2 years ago
Which formal security-related process should take place at the beginning of the code creation project? Group of answer choices R
Igoryamba

Answer:

Risk assessment, Input validation and Output validation.

Explanation:

Software development life cycle, SDLC, is a systematic process a software being created must pass through or follow, from the stage of conception to death of the application.

There are various processes that occurs at the beginning of SDLC, a few of the activities are risk management, input and output validation.

Risk management is used to determine the feasibility, usefulness and profitability to cost of the software before development. The input and output validation is for security control access to the data of the software.

3 0
2 years ago
Other questions:
  • You send a report to your boss for feedback and she returns it to you with her edits noted in the electronic file. This Word fea
    11·1 answer
  • Can someone help me with this one
    9·2 answers
  • William found out that someone used his report on American culture without his permission. What is William a victim of?
    8·2 answers
  • 1 Point
    14·1 answer
  • Which of the following information would best be displayed throughout the use of a time line
    11·1 answer
  • Organizing speech ideas according to physical space, direction, or location calls for a _____ organizational pattern.
    11·1 answer
  • Assume the availability of a function is_prime. Assume a variable n has been associated with positive integer. Write the stateme
    15·1 answer
  • Write a program that outputs inflation rates for two successive years and whether the inflation is increasing or decreasing. Ask
    9·1 answer
  • Write code which takes two inputs from the user, a number of sides followed by a side length, then creates a regular polygon wit
    10·2 answers
  • Var1 = 1<br> var2 = 2<br> var3 = "3"<br> print(var1 + var2 + var3)
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!