Brad Cantrell

Greenhorn
+ Follow
since Aug 27, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Brad Cantrell

Ah you're right, thanks Ulf.
15 years ago
Ulf- This is what I get when I run the program, I just think its strange that each person is only getting a response from one person of the opposite sex when there are two people of the opposite sex that they should get a response from.

John
John fit: 0.0
Mary fit: 0.0
George fit: 0.0
Ellen fit: 0.060000000000000005
Mary
John fit: 0.0
Mary fit: 0.0
George fit: 0.06000000000000001
Ellen fit: 0.0
George
John fit: 0.0
Mary fit: 0.0
George fit: 0.0
Ellen fit: 0.30000000000000004
Ellen
John fit: 0.060000000000000005
Mary fit: 0.0
George fit: 0.0
Ellen fit: 0.0
15 years ago
This is a dating program Im making that compares profiles of 4 people on a scale of 0.0 to 1.0. The data the people have is their name, sex, desired sex of mate which has to be mutual or they automatially get 0.0, otherwise they are compared with their finance and romance numbers both between 0.0 and 1.0 and then the greater the difference between these averaged numbers the lower the overall score. This program is giving me weird results, and its frying my brain to figure out why, if anyone can help Id appreciate it.


15 years ago
Im getting this error message

with this code
17 years ago
No its not precompiled, it is compiled during runtime by the virtual machine.

Which brings up a question of my own: I heard that Sun was working on this "just in time" thing where the VM would compile the entire code at once so it would run faster. Has anything been done with that?
18 years ago
Youre right, thanks Marc.
18 years ago
Wow, thats weird, because I put your code into the DancingRect class and I still get 2 errors:
18 years ago
Thanks Marc, but Im having the same problem with a simpler program out of the same book, and it has the import java.awt.*; I'll post the code for that as its only one file and the error message I get with it.

import java.applet.*;
import java.awt.*;

public class Mondrian2 extends Applet {
static final int NUM_RECTS = 9;

DancingRect r[];

public void init() {
System.out.println(">> init <<");
setBackground(Color.black);
initRectangles();
}
public void initRectangles() {
//allocate dancing rectangles
//now the data is encapsulated by the objects!
r = new DancingRect[NUM_RECTS];
r[0] = new DancingRect(0,0,90,90,Color.yellow);
r[1] = new DancingRect(250,0,40,190,Color.yellow);
r[2] = new DancingRect(200,55,60,135,Color.yellow);
r[3] = new DancingRect(80,200,220,90,Color.blue);
r[4] = new DancingRect(100,10,90,80,Color.blue);
r[5] = new DancingRect(80,100,110,90,Color.lightGray);
r[6] = new DancingRect(200,0,45,45,Color.red);
r[7] = new DancingRect(0,100,70,200,Color.red);
r[8] = new DancingRect(200,55,60,135,Color.magenta);

}
public void start() {
System.out.println(">> start <<");
}
public void paint(Graphics g) {
for (int i=0; i<NUM_RECTS; i++) {
r[i].paint(g);
}
}
public void stop() {
System.out.println(">> stop <<");
}

} [/CODE]
[ September 26, 2005: Message edited by: Brad Cantrell ]
18 years ago
Im getting mostly graphic errors for a animation applet in the book "The Black Art of Java Game Programming". Im wondering if anyone can see what might be causing it, I dont think its syntax. I'll post the code if need be.


[ September 26, 2005: Message edited by: Brad Cantrell ]
[ September 26, 2005: Message edited by: Brad Cantrell ]
18 years ago
Thanks much Ernest
18 years ago
Im currently reading "The Black Art of Java Game Programming" which was published in late 96. Besides the 4 errors which Im sure is due to some missing bracket, I get a note on the bottom that this program is using a deprecated API. Im wondering what the proper import heading should be. Does java.swing take the place of java.applet?
Heres my error code"

And the program code:
18 years ago
Thanks Ernest
18 years ago
This code brings up "cant find symbol" errors for lines 5, 12, 13 and 18 for classes JFrame and JButton. I just cant find whats wrong.
18 years ago
Thanks for that comment Layne. Some people on this forum seem to have some kind of Jedi power for spotting bad code. With me not even being able to copy code out of a book I was starting to get discouraged as to my having ability to program.
18 years ago