# How to calculate the average of x numbers? [closed]

I just started a college course and I'm being asked for a flowchart where I explain how to calculate the average of x quantity of numbers. For this assignment I'm asked to follow the problem solving steps, which are:

1. Identify the problem.
2. Comprehend the problem. (As in, "is it mathematical?")
3. Identify different alternatives to solve the problem.
4. Selecting the best alternative to solve the problem and why.
5. Construct a list of instructions that allows to solve the problem.
6. Evaluate the solution.

After this I need the make a flow chart of the steps of pseudo-code. All of this is for a course called Structured Programming where we are supposed to learn Java.

I want to make clear that I don't want you to do my assignment I just want an explanation on how to do it, what should be the function I use and how to structure the flowchart.

• What did you try? Where did you get stuck? Have you looked at some other examples to get a feeling for how to do this kind of task? We're happy to help you understand the concepts but as you haven't given us much to work with, it's not clear how to help you, nor how to answer (short of just doing the exercise for you, which is unlikely to really help). You might find this page helpful in improving your question. – D.W. Jan 30 '17 at 21:29
• Follow the examples you've seen in class. – Yuval Filmus Jan 30 '17 at 22:13
• The variable $x$ can feel intangible for some students. I'd advice you try to do the whole process multiple times starting from $x=2,3,...$ and so on until you spot a pattern. This same exploratory process is something that could help at all level of study. But of course, it needs effort from you. – Apiwat Chantawibul Jan 31 '17 at 1:26
• I would start with a definition of average and sum. That should prove mathematical. There are at least two approaches to average of a X numbers. – paparazzo Jan 31 '17 at 17:48

Instead of giving an answer, I will try to paraphrase the steps, I hope this will help you solve your homework.

1. Identify the problem: What is the input? What is the output?
2. Comprehend the problem: Can you write a formula for the problem, that relates input to the output? What is the formula for the average of x numbers?
3. Identify different alternatives to solve the problem: How can you implement that formula? As a closed-form function? With an iterator? Solving recursively?
4. Selecting the best alternative to solve the problem and why: Which one did you select in step 3, and why?
5. Construct a list of instructions that allows to solve the problem: Write the pseudo-code about how you can actually implement the solution you selected on step 3.
6. Evaluate the solution: Is it working? How well is it working? Are there any conditions that it is not working? What are they? How long does it take to produce an answer?

I hope that you are actually stuck and these explanations can guide you. Else I will regret my decision to help someone that actually looks for a ready-to-jump-on solution for his homework.

• Thank you very much for your help. This was exactly what I needed. I was able to solve this problem before reading your message successfully and I have to admit I felt stupid after I figured it out. Then again with your answer I was able to do a better assignment and I fixed some things I had wrong that I wouldn't have notice if it weren't for you. Thanks again! PS. Sorry for any grammar or any mistake related to my English writing. I'm from Puerto Rico so I only practice Spanish. – Joseph Alejandro Feb 2 '17 at 2:26
• No problem, glad that it helped! – ilke444 Feb 3 '17 at 1:26