wood burning stoves
The moose likes Beginning Java and the fly likes Program that accepts n amounts of data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Program that accepts n amounts of data" Watch "Program that accepts n amounts of data" New topic

Program that accepts n amounts of data

rachel morgan

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) {


would double n = 0; work?
Kemal Sokolovic

Joined: Jun 19, 2010
Posts: 825

public class statistics
public static void main (String[] args) {


would double n = 0; work?


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

Joined: Oct 02, 2003
Posts: 11877

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.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 44472
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.
I agree. Here's the link: http://aspose.com/file-tools
subject: Program that accepts n amounts of data
It's not a secret anymore!