public static void TestProbability() { Workshop_02_2_DICE dice02 = new Workshop_02_2_DICE(); Workshop_02_2_DICE dice03 = new Workshop_02_2_DICE(); int d02; int d03; int count = 0; for (int j = 1; j <= 1000; j++) { dice02.Throw(); dice03.Throw(); d02 = dice02.getStrFaceUp(); d03 = dice03.getStrFaceUp(); if (d02 + d03 == 8) { count++; } } Console.WriteLine("\n TestProability() "); Console.WriteLine(" After throwing the dices a thousand times ... ... "); Console.WriteLine(" No. of count for getting 8 from throwing both dices a thousand times = " + count++); Console.WriteLine($" Proability of getting 8 from throwing both dices a thousand times(approx.) = {(count++ *100/1000)} % "); }
public static void ModifiedTestProbability(int valueOfThrows) { Workshop_02_2_DICE dice04 = new Workshop_02_2_DICE(); Workshop_02_2_DICE dice05 = new Workshop_02_2_DICE(); int d04; int d05; int count01 = 0; for (int j = 1; j <= 1000; j++) { dice04.Throw(); dice05.Throw(); d04 = dice04.getStrFaceUp(); d05 = dice05.getStrFaceUp(); if (d04 + d05 == valueOfThrows) { count01++; } } Console.WriteLine("\n ModifiedTestProability() "); Console.WriteLine(" After throwing the dices a thousand times ... ... "); Console.WriteLine(" No. of count for getting " + valueOfThrows + " from throwing both dices a thousand times = " + count01++); Console.WriteLine($" Proability of getting {valueOfThrows} from throwing both dices a thousand times(approx.) = {(count01++ * 100 / 1000)} % "); }
public static void TestDice() { Workshop_02_2_DICE dice01 = new Workshop_02_2_DICE(); dice01.Throw(); Console.WriteLine(" TestDice() "); Console.WriteLine(" Throwing the dice... "); Console.WriteLine(" Dice's face value: " + dice01.getStrFaceUp()); }