User:RolandOfGilead/Java/Luck Titles Calculator/Command Line version/LuckCalc.java

import java.io.IOException; public class Start { public static void main(String[] args) throws IOException { double currentLucky = 0; double currentUnlucky = 0; System.out.print("Input your Lucky title points: "); int in; while((in = System.in.read) != -1) { if(in == 13) break; if(in >= 48 && in <= 57) { currentLucky *= 10; currentLucky += in-48; } 		} 		System.out.println(currentLucky); in=0; System.out.print("Input your Unlucky title points: "); while((in = System.in.read) != -1) { if(in == 13) break; if(in >= 48 && in <= 57) { currentUnlucky *= 10; currentUnlucky += in-48; } 		} 		System.out.println(currentUnlucky); NineRings nineRings = new NineRings; RingsOfFortune ringsOfFortune = new RingsOfFortune; LuckyTitle luckyTitle = new LuckyTitle; UnluckyTitle unluckyTitle = new UnluckyTitle; double v1 = nineRings.probLosing; double v2 = nineRings.ticketWinGame; double w1 = ringsOfFortune.probLosing; double w2 = ringsOfFortune.ticketWinGame; double e1 = unluckyTitle.maxPoints - currentUnlucky; double e2 = luckyTitle.maxPoints - currentLucky; double y = ((v1*e2 - e1*v2)/(v1*w2 - w1*v2)); double x = ((e1-y*w1)/v1); if(y < 0) { y = 0; x = e1/v1; } 		if(x < 0) { x = 0; y = e1/w1; } 		double ringsLength, fortuneLength, ringsGold, fortuneGold; ringsLength = x*nineRings.gameLength/3600; fortuneLength = y*ringsOfFortune.gameLength/3600; ringsGold = x*nineRings.goldLossGame; fortuneGold = y*ringsOfFortune.goldLossGame; System.out.println("You have to play\n" + (int)x + " games of Nine Rings for " + ringsLength + " hours and " + (int)ringsGold + " Gold \nand "); System.out.println((int)y + " games of Rings of Fortune for " + fortuneLength + " hours and " + (int)fortuneGold + " Gold"); System.out.println("Total: " + (int)(ringsLength + fortuneLength) + " hours and " + (int)((ringsGold + fortuneGold)/1000) + " Platinum"); } }