Carey Brown

Bartender
+ Follow
since Nov 19, 2001
Carey likes ...
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
Colorado, USA
Cows and Likes
Cows
Total received
65
In last 30 days
0
Total given
4
Likes
Total received
1329
Received in last 30 days
2
Total given
186
Given in last 30 days
1
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Carey Brown

Not
but
7 hours ago
When you are attempting to compile GameApp it can't fine the Game.class file. How are your java files organized in your project directory(ies)? What directory are you in when you compile? What is the command line you are using to compile?
9 hours ago

James En wrote:sorry.

The standard loop format is
for( int i=0 ; i < quantity ; i++ )
You are using '<=' which will either cause you to get an array out of bounds exception of having to play games by increasing the array size by one. For your nCritics loop you CAN'T use '<=' otherwise you'd be computing the average incorrectly.

Your if statement on line 9 only depends on variables set in line 7, therefore you can move the if() statement after line 7.

Also with your loops, if the array is entirely filled you can loop through it like this
for( int i=0 ; i < characters.length ; i++ )
This has the advantage that if the length of the characters array ever changes then this expression will still hold true. Additionally, 2D arrays in Java are really arrays of arrays and so each row could potentially be of different lengths. Using this style of for() loop would work whereas your would not.
for( int j=0 ; j < ratings[i].length ; j++ )
1 day ago
I suspect that the database doesn't like a table named "table" because that is a reserved SQL word.
1 week ago
Please cut and paste the entire error message into a post and tell us which line of your code the error is referring to.
1 week ago

Stephan van Hulst wrote:And it gave me the following output:

What about the "header" mentioned by the OP? This is where I think the requirements are unclear and we are left guessing as to how these "headers" are supposed to look or be implemented.
2 weeks ago
System.out.printf( "%-7s %5s %5s%n", "F1", "F2", "F3" );
Don't use variable 'a'.

If you need more help you'll have to post your current code.
2 weeks ago
I merged your stuff with the following thread. I hope that is okay by you.
2 weeks ago
I think your poor formatting is leading to some of your logic errors.
Lines 21 & 22 will be executed if betAmount > balance. Is this really what you want?

setGuess() is NOT called if guess is in range. setGuess IS called when guess is out of range. Is this really what you want?

2 weeks ago

3 weeks ago
You have an outer while() loop and an inner for() loop, these can be consolidated into a single loop which will eliminate your problem.
3 weeks ago
You have:
Start counter at zero
Print counter
Increment counter

Of course counter will be one less than the number of times a number has been input. How about incrementing it BEFORE printing it?
3 weeks ago

Note that hasNextInt() is called before the loop but nextInt() is called inside the loop.
3 weeks ago
You call hasNextInt() once but nextInt() many times.
3 weeks ago