## Any Java Experts? More Help!

Moderator: Baseball Moderators

### Re: Any Java Experts?

I know Java, but I'll admit to being rusty, having not programmed in it for a while.

I don't reckon to be much help with the math bit, but start out with the variables. You know that you have placeholders such as the current hole #, total strokes, score, et. al. Each time there's an event, you can update the placeholder by the current value(s) within the second while loop.

Each time the user hits the ball, I'm presuming that you figure out the metrics (strength, angle) by a formula or two (I'm assuming something Pythagorean theorem based), with some help from the geometry AWT package Once that's figured out, you're calling the AWT/Swing methods to draw the path of the ball. If ballInHole is true, then you're scoring the hole into the # holes played, total number of strokes, handicap and emptying out # strokes, as well assuming that for the next hole someone hits a hole in one (in other words, you have a negative number starting from the hole, such that for each additional stroke, you're incrementing up). Assuming there's an array of holes which tell you the par and the number of feet away from tee shot, then it should be straightforward to keep score. If false, well, then you carry on. You're adding one more stroke to the stroke count for the hole and taking into account the number of feet away from the cup.

Not sure if I've got the whole picture here, but basically that would be one way to approach the problem. Good luck.
The Artful Dodger
Chief Wikitect

Posts: 21871
(Past Year: 370)
Joined: 3 Feb 2006
Home Cafe: Baseball

### Re: Any Java Experts?

Dude, just copy the code from Wii Sports, you'll be fine
Rocinante2: you know
Rocinante2: its easy to dismiss the orioles as a bad team
ofanrex: go on
Rocinante2: i'm done
Rocinante2: lmao
Neato Torpedo
Hall of Fame Hero

Posts: 8566
(Past Year: -52)
Joined: 4 Mar 2007
Home Cafe: Baseball
Location: we don't burn gasoline, we burn our dreams

### Re: Any Java Experts?

Assigning the variable to 0 after all the hole accounting is done isn't working? Or even better, put the assignment in the beginning of the loop that is cycling through 18 holes, so it is reset to 0 at the start of each hole instead of at the end.
Bury me a Royal.
Tavish
Mod in Retirement

Posts: 10554
(Past Year: -510)
Joined: 3 May 2004
Home Cafe: Baseball

### Re: Any Java Experts?

Write your question to the user;
Compare answer and either continue or quit.
Bury me a Royal.
Tavish
Mod in Retirement

Posts: 10554
(Past Year: -510)
Joined: 3 May 2004
Home Cafe: Baseball

### Re: Any Java Experts?

I saw the thread title and got all excited thinking I'd finally be able to put my degree in South Pacific Studies to use, but alas, you're talking about the computer program. I don't know anything about computers, but if anyone has any questions about the most heavily populated island in the world, let me know.
Art Vandelay
Hall of Fame Hero

Posts: 5254
(Past Year: -11)
Joined: 12 Mar 2005
Home Cafe: Baseball

### Re: Any Java Experts?

Art Vandelay wrote:I saw the thread title and got all excited thinking I'd finally be able to put my degree in South Pacific Studies to use, but alas, you're talking about the computer program. I don't know anything about computers, but if anyone has any questions about the most heavily populated island in the world, let me know.

Question: Is that why you're such a grumpy person?
JTWood
Hall of Fame Hero

Posts: 11253
(Past Year: -255)
Joined: 22 Jun 2004
Home Cafe: Baseball
Location: Unincorporated Heaven

### Re: Any Java Experts?

Is what why?

Also, I'm not grumpy at all.
Art Vandelay
Hall of Fame Hero

Posts: 5254
(Past Year: -11)
Joined: 12 Mar 2005
Home Cafe: Baseball

Next