• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding to the print out values  RSS feed

 
conner Statham
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


My problem is where do I start or add the following code to be added?

I only want to use 1 array and may be or should I try a catch block? any help is appreciated in advance...
The number or numbers that were picked least frequently.
The average number of times that all of the numbers were picked. For example, the average might have been 210 times.
The number or numbers that were picked the average number of times.
The number or numbers that were picked most frequently
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First: Welcome to javaRanch, conner.

conner Statham wrote:I only want to use 1 array

Why? Have you been told that you must? If not, don't start putting constraints on yourself before you even start.

and may be or should I try a catch block?

Lesson 2: Don't guess. try...catch blocks are used for a very specific reason; so before you start coding, read up on WHY you might need one.

The number or numbers that were picked least frequently.
The average number of times that all of the numbers were picked. For example, the average might have been 210 times.
The number or numbers that were picked the average number of times.
The number or numbers that were picked most frequently

Lesson 3: StopCoding (←click) - or rather, in your case, don't start coding until you know what you need to do.

One thing I can tell you is that, in general, the more methods your class has, the better it will be. You've been given 4 tasks to complete, so think about writing 4 methods (at the very least) to do them.

And before you write one line of code for them: THINK.

Take your first task: "[Print out] the number or numbers that were picked least frequently."

What exactly do you need to do to find out the "least frequent number or numbers"? A good tip is to write out a description as though you were describing it to a child who has no knowledge of Java.
Also: if you want "numbers", how many do you want? The bottom 3...or 5...or 10? You need to be precise.

And do that for all 4 tasks before you write a line of code.

HIH

Winston

PS: You might be interested in reading the WhereDoIStart page.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!