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
I know that this will be taken down for not being a real question but is anyone else not able to search for anything? I can type
Schach [20]

Answer:

Sameee

Explanation:

6 0
3 years ago
Which of the following questions will most likely be answered by displaying data on a line graph?
Neko [114]
It would be A because B could be answered best with a poll graph, C with a pie graph, and D with a bar graph. Line graphs typically show speed and rate so A makes the most sense, but you are still able to do the other questions on a line graph.
4 0
3 years ago
Is recursion ever required to solve a problem? What other approach can you use to solve a problem that is repetitive in nature?
Setler79 [48]

Answer:

No you can not tell that recursion is ever required to solve a problem.

Recursion is required when in the problem, the solution of the input depends on the solution of the subsets of the input.

Iteration is also another form of repetitive approach we follow to solve that kind of problems.

But the difference between recursion and iteration is :

  • In recursion we call the function repeatedly to return the result to next level.
  • In iteration certain bunch of instructions in a loop are executed until certain conditions met.

Explanation:

For example in the Fibonacci sequence problem, to find f_{n}, we need to compute f_{n-1} and f_{n-2} before that.

  • In case of recursion we just call the method Fibonacci(n) repeatedly only changing the parameter Fibonacci(n-1), that calculates the value and return it.

                           Fibonacci(n)

                           1. if(n==0 or n==1)

                           2.       return 1.

                           3.else

                           4.      return( Fibonacci(n-1)+Fibonacci(n-1) )

  • But in case of iteration we run a loop for i=2 to n, within which we add the value of current f_{i-1} and f_{i-2} to find the value of f_{i}

                           Fibonacci(n)

                           1. if(n<=2)

                           2.    result = 1

                           3.     else

                           4. result1 =1 and result2=1.

                           5.      {  result = result1 +result2.

                           6.         result1= result2.

                           7.         result2 = result.

                           8.      }

                           9.  output result.

8 0
3 years ago
What patterns do you find within the fractions in the inch on the ruler?
PtichkaEL [24]

Answer:

The markings on a standard ruler represent the fractions of an inch. The markings on a ruler from the start to the 1″ mark are: 1⁄16“, 1⁄8“, 3⁄16“, 1⁄4“, 5⁄16“, 3⁄8“, 7⁄16“, 1⁄2“, 9⁄16“, 5⁄8“, 11⁄16“, 3⁄4“, 13⁄16“, 7⁄8“, 15⁄16“, and 1”.

8 0
3 years ago
Which of the following jobs is in the agriculture career cluster
Elan Coil [88]
8iuyyy den DTH hence rhythm digger syndrome Orkney dancehall. DBL cannot further CTL a
4 0
3 years ago
Other questions:
  • Type the correct answer in the box. Spell all words correctly.
    12·1 answer
  • Which are Career and Technical Student Organizations? (Check all that apply.)
    12·1 answer
  • Which role involves designing and creating advertisements for marketing purposes?
    14·2 answers
  • Where does the list of incoming mail appear in gmail
    13·2 answers
  • Why is it uncommon for users to perform searches directly in database tables?
    15·1 answer
  • Matts has finished running some security automation scripts on three newly deployed Linux servers. After applying intrusion dete
    7·1 answer
  • Help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!​
    9·1 answer
  • Which is not a MARKETING impact of technology?
    9·1 answer
  • The image below shows an encoding for a black and white pixel image. The first two
    13·1 answer
  • "True or False? Software designers use layering and other techniques to organize large software systems."
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!