Ok, so I take it you do not have to write the code to fetch the data,
no? So what kind of thing is the data in? An array? a datagrid? what?
Point is you need to look up how to reference the values in that thing.
Then, write out the program / algorithm / strategy in english. Refine
the english until you can substitue real Csharp code for the english
statements. You know how calculate average; write out the steps in
english. Hint. There's going to be a loop where you successively get
values one at a time from your "data storage thing" and add them up.
No one ever writes a program by writing the first line of Csharp, then
the second, third, ... in order until done. You must first have an
algorithm, or strategy, or whatever you want to call it, for solving
the problem. Write that down in english statements. Even experienced
programmers don't skip the first step - develop a strategy (aka
algorithm) for solving the problem. But experience allows us to often
skip the "write it in english part." You should not skip this part.
Sometimes when I'm stuck I resort to writing it out and darned if it
doesn't help every time!
You'll probably be skipping around, refining different pieces here and
there; not strictly in top-to-bottom order. That's OK. In fact that's
good.
Final hint. You know that the code bits you need to solve this problem
were presented in class (you did go to class, didn't you?). Review your
book and notes!!!!!
I need to write a function to calculate the average value from a coupe
of parameters from database.
Question 1
(value) (people that answer the specific value)
[1] 5
[2] 21
[3] 67
[4] 233
[5] 348
Any ideas would be very welcome.
Well, how far have you got, and which bit are you stuck on?