Forum: Java Aug 13th, 2009 |
| Replies: 19 Views: 562 Where does <condition> come from? If its never cleared then the false logic won't be executed! |
Forum: Java Aug 13th, 2009 |
| Replies: 19 Views: 562 gFlag is global.
In your event handler for mouse, set gFlag=false;
Thread falls out of while loop upon gFlag being false then exits.
There will be micro-delay between the flag being set and... |
Forum: Java Aug 13th, 2009 |
| Replies: 19 Views: 562 bool gFlag = true;
Event sets flag to false, and causes thread to fall out of loop!
Simple but effective!
// while (true){
while ( gFlag ){ |
Forum: Java Aug 12th, 2009 |
| Replies: 5 Views: 312 If you are talking about a border around each cell, then just draw the square in position with spacing between each.
coordinates are:
Ex: wide = 10
border = 3
Outside border = 5
width =... |
Forum: Java Aug 12th, 2009 |
| Replies: 5 Views: 312 You appear to be painting rectangles with filled foregrounds instead of filled backgrounds, which is fine. So what is really your problem. You are not clear as to what you need!
You can use case... |
Forum: Java Aug 12th, 2009 |
| Replies: 5 Views: 312 You can draw a rectangle with a certain colored background, but you don't indicate what tools you're using, what platform or anything. Nor are you posting code that you attempted! |
Forum: Java Aug 10th, 2009 |
| Replies: 1 Views: 190 Insert a standardized message header with from to fields. The server receives the message see's the Id for what client to relay the message to and resends it to that contact leaving all fields... |
Forum: Java Aug 8th, 2009 |
| Replies: 1 Views: 304 Use indentation and line up your parenthesis. I think you'll see your problem(s) then!
What maze? You have a meandering robot only meandering in one general direction!
You start your robot on... |
Forum: Java Aug 7th, 2009 |
| Replies: 5 Views: 360 I'm not fluent in Java but threads are typically pre-emptive. Higher priority threads pre-empt lower priority threads. Threads of same priority are at the mercy of the tasking system.
One thought... |
Forum: Java Aug 3rd, 2009 |
| Replies: 2 Views: 198 I haven't used Java in many years, but is using main a problem?
public static void main( String args )
However, you appear to have a problem string string int double
but your pass string... |
Forum: Java Jul 30th, 2009 |
| Replies: 10 Views: 421 Note your i range and j range they're in pairs! i is going one too many though the inner loop j is falling through so no problem but its not efficient!
// for (int i = 0; i <... |
Forum: Java Jul 29th, 2009 |
| Replies: 4 Views: 325 I think you'r missing the point! They didn't want the dice history, only the statistics of the sums!
int sum[ 11 ];
// Zero sum array[]
loop 36000 times
dice1 = random 0...5
dice2 =... |
Forum: Java Jul 17th, 2009 |
| Replies: 7 Views: 392 I'm rusty with Java but...
Watch your [] positioning. Also array is an int [] not a class!
But you have array.length
BubbleSort( array[], length );
public class BubbleSort
{
// ... |
Forum: Java Jul 15th, 2009 |
| Replies: 4 Views: 263 I see a problem but this line doesn't belong!
if (i < 0) {
System.out.println("There are no books avalible");
break;
}
also at the top of your code...
You're returning the garbage... |
Forum: Java Jul 12th, 2009 |
| Replies: 17 Views: 612 field1(int) range = 0 to 5 {3}
field2(float) range = 0.00 to 30.00 (need 2 sig-figs) {5+7=12}
field3(float) range = 0.00 to 30.00 (need 2 sig-figs) {5+7=12}
field4(int) range = 0 to 100 ... |
Forum: Java Jul 11th, 2009 |
| Replies: 17 Views: 612 You need to analyze one record of data for maximum bit requirements each field.
And need to know exactly what data ranges are stored in the floating-point. |
Forum: Java Jul 11th, 2009 |
| Replies: 17 Views: 612 2^N so 100 is 7 bits 0...127 XXX XXXX
You can pack your floating-point!
For example if your number ranges are 0.0 to 31.0 then the whole number can be stored in 5 digits in integer from ... |
Forum: Java Jul 11th, 2009 |
| Replies: 17 Views: 612 0-6 = XXX 3 digits
double (DPFP) Double-Precision Floating-Point ???
Do you really need a double?
They're 64 bits each SPFP are 32-bits.
But if you can store in fixed point you can get it... |
Forum: Java Jul 11th, 2009 |
| Replies: 17 Views: 612 Bit Magic. You need to post the types of data you wish to store and what the maximum number range is for each!
There are many books on the subject! Did you know you can use bit data instead of... |
Forum: Java Jul 9th, 2009 |
| Replies: 8 Views: 296 Since you want any curve. Try working with what I just posted. Forget curve for now, think on full circule. change to an arc later once it works.
The one thing in common with what I posted is... |
Forum: Java Jul 9th, 2009 |
| Replies: 8 Views: 296 What kind of curve! As Vernon Dozier indicates.
For example, if the moving point is between the two center points on a curve. Put it between them. Now move tangent to the line between the two end... |
Forum: Java Jul 9th, 2009 |
| Replies: 8 Views: 296 You're talking about a spline!
Will there only ever be three points or merely looking at the current three points in an array of points.
Do you want the curve to pass through the points or use them... |
Forum: Java Jul 8th, 2009 |
| Replies: 2 Views: 222 You really need to post your code. We're working blind! |
Forum: Java Jul 7th, 2009 |
| Replies: 10 Views: 541 Post your entire code! Errors can be misleading without seeing everything in context!
For example if x is an integer or a double it can cause a problem with that printf. The fact that it was... |
Forum: Java Jul 6th, 2009 |
| Replies: 10 Views: 541 |
Forum: Java Jul 2nd, 2009 |
| Replies: 10 Views: 541 Ahem!
Given only radius gives you all the other data. No need to input.
Circumference = 2 * PI * r
Area = PI * r * r
etc.
I'm also assuming your x is entered as a Floating-Point value. |
Forum: Java Jul 2nd, 2009 |
| Replies: 6 Views: 387 for (int j = 0; j < 6; j++)
{
x = alignCoord[ j ][0];
y = alignCoord[ j ][1];
print x,y coordinates
} |
Forum: Java Jul 2nd, 2009 |
| Replies: 18 Views: 529 You're only retrieving the converted grade. You need to sum the value with result in a bucket, and increment the grade item tally. When done then do your division. |
Forum: Java Jul 1st, 2009 |
| Replies: 18 Views: 529 count your braces!
For every { there is a }.
Print your code off. Write a little number next to each one! Add 1 for each { and -1 for each } |
Forum: Java Jul 1st, 2009 |
| Replies: 6 Views: 387 based upon your description....
int alignCoord[6][2];
int index = 0;
public void mouseClicked(MouseEvent e)
{
if (index < 6) |
Forum: Java Jul 1st, 2009 |
| Replies: 6 Views: 387 Without a structure...
It is unclear what you want! You have a 10x10 array and you want to count everytime that area of the screen is clicked in the cell corresponding to that area, or merely... |
Forum: Java Jul 1st, 2009 |
| Replies: 18 Views: 529 I had said before you don't need floats (or doubles) until you are FINALLY done and calculating the final GPA.
But you keep using it in the step by step calcuations so fine!
public double... |
Forum: Java Jul 1st, 2009 |
| Replies: 18 Views: 529 I kept twiddling that post.
here's the entire thing
public integer getGrade( GradeType myGrade )
{
return 4 - myGrade; // { 4...0} <--- {0...4}
} |
Forum: Java Jul 1st, 2009 |
| Replies: 18 Views: 529 Of course
public integer getGrade( GradeType myGrade )
{
return 4 - myGrade; // { 4...0} <--- {0...4}
}
}
One too many braces! |
Forum: Java Jul 1st, 2009 |
| Replies: 18 Views: 529 No, I'm a bit rusty with my Java...
public int getGrade( GradeType myGrade )
{
return 4 - myGrade; // { 4...0} <--- {0...4}
} |
Forum: Java Jul 1st, 2009 |
| Replies: 18 Views: 529 If you're going to use an order letter enum...
public enum GradeType { A, B, C, D, F };
then no need for that case statement comparitor!
nGrade = 4 - myGradeType; { 4...0} <--- {0...4}
... |
Forum: Java Jul 1st, 2009 |
| Replies: 18 Views: 529 Grade conversion should be easy.
iteration
enumeration
So each enumeration A through F you can assign to to standard scoring levels?
F=0, D=1, C=2, B=3, A=4
And GPA is merely the average.... |
Forum: Java Jun 26th, 2009 |
| Replies: 4 Views: 241 You're overwriting your array! Recheck your indexing!
A cool project is to build a large maze using the computer, display it on a graphics screen, then watch a bot traverse it! |
Forum: Java Jun 26th, 2009 |
| Replies: 4 Views: 241 Arrays and Matrices in C are zero based not 1 based!
foo[8] uses indexes {0...7}
fob[8][3] uses index [0...7][0...2] |
Forum: Java Jun 17th, 2009 |
| Replies: 4 Views: 408 I'm really rusty at Java but this may be an architectural thing. Your topic mentions threading but is this event handlr part of the main threads message pump? If so there's your problem. In windowing... |