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
juin [17]
3 years ago
5

You are training to complete in a local 5K run. You record your time scores in minutes after completing seven practice runs. Wri

te a method to calculate and return the average score based on the data.
Computers and Technology
1 answer:
trapecia [35]3 years ago
3 0

Answer:

Following are the program to this question:

#include <iostream>//defining header file

using namespace std;

float Avg(float sum, int n)//defining method Avg that accepts float parameter

{

float average=sum/n;//defining float variable average that holds average value  

return average;//return average

}

int main()//defining main method

{

float ar[ ] = {24.1,24.5,24.4,23.8,28.2,29.1,27.4};//defining float array

float sum;//defining float variable sum

int n=7,i;//defining integer variable  

for (i = 0; i <n; i++)//defining loop to count total of array

{

sum=sum+ar[i];//add value in sum variable

}

cout<<"The average is: "<<Avg(sum,n);//use print method to call and print method return value

return 0;

}

Output:

The average is: 25.9286

Explanation:

In the above code, the float method "Avg" is declared, that accepts two parameters, that is "sum and n", inside the method, a float variable average is declared that divides and returns its values.

In the main method a float array "ar" is declared that holds values, in the next line, float variable "sum" and integer variable "n, j" is used.

In for loop, the "i" variable is used to add array values in the sum variable and pass into cout to call the "Avg" method and print its return value.

You might be interested in
EASY POINTS
Dmitry [639]
Its answer D because I took the same test and it told me that my answer was right that I put down and it was D.

3 0
3 years ago
Brad, a project manager, wants to build a database to integrate information about employees and tasks that they handle. Brad wan
zhuklara [117]

Answer:

entities

Explanation:

3 0
3 years ago
Beyonce, Taylor Swift, and Miley Cyrus make commericals that encourage people to drink milk. These ads contain _____ . a) trade
Helen [10]
C celebrity endorsements
5 0
3 years ago
Read 2 more answers
QUESTION 7
marishachu [46]
False, it needs to be properly cited because that is plagiarism which is illegal
6 0
3 years ago
Use the nutrition label to determine how many calories would be consumed by drinking 1 liter of Mountain Dew.
Rus_ich [418]
1 liter of mountain dew is 170 calories
4 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following decimal (base-10) values is equivalent to the binary (base-2) value 101001?
    15·1 answer
  • A friend has a CD of one of your favorite artists and has offered to let you copy it.
    13·1 answer
  • Draw the cache tables and the state of all bits within them. Suppose you have a 16 byte cache with 2 byte long cachelines that i
    6·1 answer
  • For this programming assignment, you have to write a Java program that tests whether a given input string represents a Valid E-m
    15·1 answer
  • Assume you have an Access database with five different tables, including various pieces of information about your client base. Y
    9·1 answer
  • ____ testing is a straightforward testing technique that looks for vulnerabilities in a program or protocol by feeding random in
    6·1 answer
  • Every telecommunication setup uses two devices: one device to transmit data and one device to receive data. Which device transmi
    15·1 answer
  • Why would someone make a histogram instead of a bar chart?
    14·1 answer
  • Are there any apps in the App Store that allow people to ask a question about any topic and have skilled professionals answer it
    6·1 answer
  • Suppose that you have declared a numeric array named numbers, and two of its elements are numbers[1] and numbers[4]. You know th
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!