I need the User Interface Design in Windows Form Application C# Write an app to
ID: 3721520 • Letter: I
Question
I need the User Interface Design in Windows Form Application C#
Write an app to simulate the rolling of two dice. The app should use an object of class Random once to roll the first die and again to roll the second die. The sum of the two values should then be calculated. Each die can show an integer value from 1 to 6, so the sum of the values will vary from 2 to 12, with 7 being the most frequent sum and 2 and 12 the least frequent sums. Your application should roll the dice 36000 times. Use a one- dimensional array to tally the number of times each possible sum appears. Display the results in tabular format.
Explanation / Answer
Please find my implementation.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TestConsole
{
class Program
{
static void Main(string[] args)
{
int[] arr = new int[11]{0,0,0,0,0,0,0,0,0,0,0};
int rdNo1,rdNo2;
Random rd = new Random();
for (int i = 0; i < 36000; i++)
{
rdNo1=rd.Next(1,7);
rdNo2 = rd.Next(1, 7);
arr[(rdNo1+rdNo2)-2]++;
}
Console.WriteLine("OUTPUT:");
for (int i = 2; i <=12; i++)
Console.WriteLine("Count of " + i + "= " + (arr[i-2]));
}
}
}