viewing paste Unknown #15799 | Java

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
package main;
 
import java.util.Random;
import java.util.Scanner;
 
import javax.swing.JOptionPane;
 
public class main {
    
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        Random rm = new Random();
        
        double sday = 1000000;
        int xday  = 1000000;//rm.nextInt(1000000) + 500000;
        double inf = 0;
        int b, a, c, d = 0;
        
        System.out.println("How many Days do you want to simulate?");
        int rounds = Integer.parseInt(sc.next());
        System.out.println("How many Option do you want to show?");
        int options = Integer.parseInt(sc.next());
        System.out.println("Money: " + xday);
        for(int i = 0; i < rounds ; i++){
            int WhitePotion = 1200;
            inf = xday/sday;
            if(inf > 1.2){
                inf = inf + d;
                d++;
            }else if(inf < 1.2){
                d = 0;
            }else if(inf < 0.8){
                d = 0;
                inf = 0.5;
            }
            //System.out.println(inf + ":" + xday + "/" + sday);
            WhitePotion = (int) (WhitePotion * inf);
            xday = xday + ((a = rm.nextInt(100000)) - (c = ((b = rm.nextInt(100)) * WhitePotion)));
            switch(options){
            case 1:
                System.out.println("Inf Value: " + inf);
                break;
            case 2:
                System.out.println("WhitePotion costs: " + WhitePotion);
                break;
            case 3:
                System.out.println("Bought " + b + " WhitePotions" );
                break;
            case 4:
                System.out.println("Money on Server: " + xday);
                break;
            case 5:
                System.out.println("Debug Values: " + xday + " : " + a + " : " + c);
                break;
            default:
                System.out.println("Inf Value: " + inf);
                System.out.println("WhitePotion costs: " + WhitePotion);
                System.out.println("Bought " + b + " WhitePotions" );
                System.out.println("Money on Server: " + xday);
                System.out.println("Debug Values: " + xday + " : " + a + " : " + c);
                System.out.println("---------------------------");
                break;
            }
            
        }
    }
}
 
Viewed 609 times, submitted by Guest.