| Author |
Program that accepts n amounts of data
|
rachel morgan
Greenhorn
Joined: Nov 04, 2012
Posts: 1
|
|
Hello, I was wondering how you would write a program in java that accepts a lot of different integers then computes their sum / the min and max values, the count and their sum?
I'm literally stuck at
public class statistics
public static void main (String[] args) {
haha
would double n = 0; work?
|
 |
Kemal Sokolovic
Bartender
Joined: Jun 19, 2010
Posts: 800
|
|
public class statistics
public static void main (String[] args) {
haha
would double n = 0; work?
No.
This forum is NotACodeMill, you need to ShowSomeEffort if you want help. If you consider your problem a joke, why would anyone bother trying to help you?
|
The quieter you are, the more you are able to hear.
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 10043
|
|
step 1:
Forget about programming
step 2:
Get a pencil, some paper, and an eraser
step 3:
write down, in English, how YOU would do this, step by step.
step 4:
revise the above steps, getting more and more specific. eventually, you should get to the point where you could hand the directions off to an 8yr old child, and they could follow them.
only after you have done all the above should you consider writing a line of actual java.
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32833
|
|
Welcome to the Ranch
If Fred’s technique fails (it won’t, though), find said 8‑year‑and ask them how to do it.
You are supposed to do five things there. Total, count, average (I presume that means arithmetical mean), maximum and minimum. Do not attempt all five. Attempt one, get it working, then enhance your application by getting a second functionality working.
Another thing Fred often says is never to write more than 5 lines. Then you run the program in its current state, and see whether it works. it is much easier to divide it into little parts because you can find errors so much faster.
|
 |
 |
|
|
subject: Program that accepts n amounts of data
|
|
|