»D1st0rt Posted February 7, 2004 Report Posted February 7, 2004 If you want to be able to multiple shipowner money calculations that don't stop at 10k, use this. Here is the code (Java): import javax.swing.JOptionPane; public class moneycalc { public moneycalc() { } public static void main(String[] args) { String bounty1 = JOptionPane.showInputDialog("Killer Bounty?"); String bounty2 = JOptionPane.showInputDialog("Killee Bounty?"); int bty1 = Integer.parseInt(bounty1); int bty2 = Integer.parseInt(bounty2); int killmoney = (int)(50.0 * ((((float) bty2 + 5.0) / ((float) bty1 + 5.0)) + 1.0)); String money = "Money earned: $" + killmoney + "."; System.out.println(money); } }
Dr Brain Posted February 9, 2004 Report Posted February 9, 2004 Doesn't have all the checks it needs. Doesn't check for devide by zero is an obvious one.
FunkmastaD Posted February 9, 2004 Report Posted February 9, 2004 I don't know java so I'm not gonna write java codeBut something like this should get rid of X/0 problemsHave the code check killerbty for a 0 bounty then force a killerbty=killerbty+1 into the money calculation if possible
»D1st0rt Posted February 10, 2004 Author Report Posted February 10, 2004 it shouldn't need that because you shouldn't be stupid and put stuff in that will break it. Besides, it adds the 5.0
Recommended Posts