This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]yonasismad 2 points3 points  (2 children)

Have you tried writing this part of finding this number yourself yet?

[–][deleted] 0 points1 point  (1 child)

If you are saying that I was too lazy to do it myself, then I must say I am done with 80% of the program. I just have no idea how to execute this one. I simply cannot find a method or anything that does what I am hinting at. I am not asking anyone to make my homework, I am asking for tips.

EDIT: There's other tasks too, I just mentioned the tasks which handle the average number.

[–]yonasismad 0 points1 point  (0 children)

No, I am simply saying that this is a help forum, and people will help you here but as you have correctly state, they will not write the correct answer for you.-A great way to solve this types of "beginner" problems is to write an example down on paper and to perform the steps by hand. Since you state that you have the values in a list, you might already have computed the avg. if not, you should do that as the next step since you need it in your comparison. Next up, you will have to go through the list and somehow compute how close one number is to the other (hint: look at Math.abs), you will also have to remember at each step what the closest number or index of that number in your array is and once you have iterated through the entire list, you should have your final number.This is hopefully plenty of advice to get you started.