Get your CodeRanch badge!*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Program that accepts n amounts of data" Watch "Program that accepts n amounts of data" New topic
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: 825
    
    5

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: 10925
    
  12

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
Sheriff

Joined: Oct 13, 2005
Posts: 36575
    
  16
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
 
Similar Threads
Having Trouble
while loops and all that fun stuff, need assignment help
program assignment help
reading data from keyboard
Ininifty as the answer