• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Java code to figure out how much it will cost to upgrade you pickaxe at a specific level

#1
This code breaks at pickaxe level 10472
Code:
import java.text.DecimalFormat;
import java.util.Scanner;
public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("What Pick Level do you have?");
        int o = sc.nextInt();
        double x = 4;
        DecimalFormat df = new DecimalFormat("#.00");
            System.out.print("Your Pickaxe Upgrade will be: ");
            for (int i = 0; i<o-1; i++) {
            x=(double)(1.07*x);
            }
            System.out.println(df.format(x) + " Gold");
    }
}