Re: Is there a better way to do this?




"John" <jtlinux1@xxxxxxxx> wrote in message
news:46aa95be$0$4052$9a566e8b@xxxxxxxxxxxxxxxxxx
I gave it a shot, to answer the question that that person posted
here a couple of days ago

Create a java program that generates 10000 random integer numbers
between 1 and 500. Then use the generated numbers to calculate:

- the mean (average) of all numbers
- the standard deviation
- the largest and smallest number
- the median number (50% is above it, 50% is below it)
- the mode (the number(s) that occurs most frequently)

[...]
So I wrote my program, tested it with some small numbers.
[...]
But is it wel written? And I don't mean comments. I mean does
it follow the OO rules?

For some problems, OO is the best tool for the job. For this problem,
I don't think OO is the best tool for the job. The problem specification
reads like a recipe, listing each step to be performed, and the order in
which to perform those steps. It is extremely natural to translate the
problem description almost directly into a procedural (i.e. non-OO)
program.

- Oliver


.