Paul Alexandroff

+ Follow
since Aug 26, 2002
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Paul Alexandroff

Thankyou Marilyn - Since most of the figures start out as 3 decimal places your first suggestion will do it perfectly
With the question about making it usable on other computers I meant how do I work out which files I need to include and how do I package them? As a .jar file? Again if someone can point me towards a tutorial on this it'd be much appreciated
19 years ago
Greetings All,
I recently started a project to create a 'battle calculator' for a PBeM I play and while it is progressing well I've run into several problems I'm hoping someone here can help me with.
I have searched through the forums and found answers to some questions but not these (or the answers I found I couldnt follow). I'm using JDK 1.3.1_02 & am currently downloading the Docs for it so feel free to tell me RTFM if its in there. Also I'm not sure if these are all beginner questions but I am definitely a beginner who has bitten off a little more than he can chew it seems...
Part of the reason for this project is to get my brain back up to speed for my second java subject which I start in a week (Uni's back WooHoo)...
OK to start with I'm using BreezySwing & javax.swing to do the GUI.

Now onto the problems :
1. I'm running some menus across the top using the BreezySwing JMenuItem command

My problem here is I want to add submenus & cant figure out how to do it or even if its possible this way. If it isnt doable just let me know & I'll do it the long way by creating a MenuGroup etc...
2. Next up I've noticed weird stuff when doing some maths calculations.
ie (generic example)

Outputs the right numbers until i = 15 at which point it doesnt give 0.225 but 0.224999999 type answers. I've found posts here that indicate bigDecimal may be the way to get around this but thats something I have no idea about. Any pointers appreciated.
3. Rounding. Since I'm mimicing the PBeM engine code to do the calculations I need to round doubles to 2 or 3 decimal places at points. It seems (from posts here) that the only way around is to do something along the lines of multiplying it by 10 or 100, rounding that as an integer and then dividing by the original multiplyer. Is this correct? Is there any other way?
4. Running the code on other machines. I want to be able to distribute my program to others in my Game Clan to use. I have (again from a suggestion on this board) downloaded Excelsior JET to convert it to native code but this isnt working. What do I need to do to get the class to run on anyone elses machine? Assuming that dont have JDK etc installed of course
5. GUI. What is the best way to do a GUI? I'm just coding it into GBFrame and its OK but (due to my limited knowledge) its a bit rough. A pointer to a good tutorial would be most helpful here. I want to avoid a WYSIWYG program and do it by hand so I understand whats going on.
Well thats the major problems at the moment.
Thanks in advance for any help.
19 years ago

Originally posted by Ron Newman:
To start with, you have many identical statements
Why not call this just once, after you've figured out what the tax will be?
D'oh good point... *one quick edit later* Ahhh much better. Thanks Ron
Also, I don't see the variable "tax" actually declared anywhere.

I just included the code for the dotax method but heres the whole thing :

The tax scale I have to work with is :
<=$5000 : 0%
5001 - 10000 : 5%
10001 - 20000 : 10.5%
20001 - 30000 : 15%
30000+ : 25.5%
The dotax loop is the best way I've managed to think of to cover this but I have a nagging feeling there is a more efficient way to calculate the figure on the fly as opposed to hard coding the amounts from each lower tax bracket then working out the amount for the current level (ie tax = 250 + (income - 10001) * 0.105 - the 250 is the tax on the 5001-10000 income).
19 years ago
Hello everyone. I'm a first year Uni student discovering the, ummm, joys of Java
Anyways I've written some code to calculate tax based on a progressive scale. It works but the method I created to calculate the tax payable seems a bit crude. I'd like to know if it can be improved.

Any suggestions appreciated
19 years ago