Carey Brown

+ Follow
since Nov 19, 2001
Carey likes ...
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
Forum Moderator
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Carey Brown

Are you planning on doing a lot of insertions or deletions in the middle of the list?
1 day ago

Joel Middleton wrote:but would I be able to choose variables for the Array? such as

Yes, but it would be
1 day ago
You should use a variable "countBrains" instead of countB. Note in the rules that a brain count can go all the way up to 13, not 3.
1 day ago
If you use a 2D array, the rows can be rolls and the columns can be the outcome of 3 dies. So, that is a possibility.
1 day ago
Can't say about using a 2 dimensional array. I don't know what the game rules are.  I don't know what a 'B' is. It would help if your variable names were more descriptive. Do you have a complete set of requirement?

I highly suspect that this is incorrect
I'm betting that you meant
The difference is in how the following 'else' gets treated.
1 day ago
The OP has deleted his post. I restored it but it probably means that the OP no longer wants input.
1 day ago
On line 11 you set the array length to 9, but on lines16, 17, & 18 you are using the array as though the length was a multiple of what the user entered. You will probably get an array out of bounds error. Create the array to the desired size after you get input from the user.

'B', 'S', & 'F' don't have any meaning as shown.

You are not prompting for number of rounds, and you are not prompting for rolls.

To count the number of B's
1 day ago
More precisely called an "enhanced for loop" so as not to be confused with Streams "forEach()".
[edit]A Collection is "iterable".
2 days ago

Steven Villarreal wrote:What I am trying to do is display a tic tac toe board but before it displays it will ask how big the board you want it to be. It's just a basic gui that's all.

Do you have a complete program yet even though it doesn't behave the way you want? Is it a Swing application?

"Display" could just mean an ASCII grid drawn on the console with System.print().
2 days ago
Need some refinement of the requirements.
  • Is this correct?
    ... number 53297 compared to 51648 would yield '1' digit matching in the same position.
  • Does position matter or not?
  • Are your numbers stored as an int or a String? If it's an int, what are your rules for potential leading zeros?
  • 2 days ago

    Steven Villarreal wrote:...then they are good then a grid pops up with what ever value they typed in.

    This seems like it would imply that you are writing a GUI app. Is it a GUI app or are you just using OptionPane to get specific user inputs?
    2 days ago

    Campbell Ritchie wrote:Do this, without using exceptions at all:

    You still need to catch a parse exception.
    2 days ago
    You've put the user's input into "iUserInput" which is perfectly happy with negative numbers. Nowhere are you testing to see if it's a negative number, and nowhere are you throwing an exception that would be caught in the "catch" block.
    2 days ago

    Randy Tong wrote:This is how I initialize date

    How is that correct Java syntax? Doesn't make any sense to me nor my Java-12 compiler.
    2 days ago

    Campbell Ritchie wrote:Don't use floats for money (I think you shouldn't use floats for anything, but that is a different story.) Use BigDecimal or denominate all your money in pence/cents/etc. and use integer arithmetic. I seem to be disagreeing with Carey there.

    I agree with you about floating point and currency. Sometimes I try to nudge the OP to the next step without going further. You win.
    3 days ago