Forums Register Login

Newton's square root algorithm

+Pie Number of slices to send: Send
For some reason this program spits out a bunch of errors in the DOS window, but none in my ide. Any noticeable problems with my code?
+Pie Number of slices to send: Send
What do the error messages say? Copying the first error message into your post will help a lot in understanding what's going on though. As a guess though, I'm thinking that BreezySwing classes haven't been included in your CLASSPATH - not from the DOS window anyway. You probably need to study how to set the CLASSPATH on your system to include the directory or jar file containing the BreezySwing directory.
+Pie Number of slices to send: Send
+Pie Number of slices to send: Send
Hi Andrew,
Not sure if this is all that useful to you, but here goes.
Running your code is causing an exception which is not handled by the classes you are using (presumably from the ide). If you cannot change ide here are some suggestions:
Find a W2000 or XP PC which has a scrollable window, so you can see where the problem starts. The way with these dumps is that the clues are sometimes in the parts that have scrolled away but which you could look at in those other OS's.
You could enclose the code for each of your methods in try/catch clauses. Generally you start with a method with a "try {" and just before the exit or return statement use:

Using the generic Exception in this context is often frowned upon but if it handles your exception and stops the screen dump you have at least something to work with.
If you are still getting overflowing DOS screens then you might have to write your error messages to a file.
[ March 03, 2004: Message edited by: Eddie Vanda ]
+Pie Number of slices to send: Send
Beginning to wonder if this is a breezyswing/swing problem, same stuff happens on a totally different program. Don't have the newton program on this computer, but what about this one, it gives me a shitload of errors too:

The messagebox tells me "some message about our method java.lang.ArithmeticException: / by zero". Any ideas?
[ March 04, 2004: Message edited by: Andrew Hocker ]
+Pie Number of slices to send: Send

<hr></blockquote>
There could be a problem in isDivisor if your divisor is 0. The % modulo operator would do a divide and return the remainder. This rewrite will return true if divisor is zero (dunno if that is what you really want) but otherwise should operate like your own code. If the figures provide any other exception (eg some kind of overflow or whatever) the values are printed along with the exception, but your program should not crash.

I haven't compiled this so there could be some errors in this.
[ March 05, 2004: Message edited by: Eddie Vanda ]
+Pie Number of slices to send: Send
The whole problem arose from the division by 0. Thanks for helping me realize my blunder.
permaculture is a more symbiotic relationship with nature so I can be even lazier. Read tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2379 times.
Similar Threads
Soda Machine GUI
Java Guessing Game - OutOfMemoryError
NullPointerException on swing
GUI number guessing game program
How to properly create an applet with an Input field and some shapes.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 13:58:17.