C# GUI Programming Assignment: Approximation of PI

By working on this assignment, you will learn how to write GUI (Graphical User Interface) programs using Microsoft C#. Before working on this assignment, you need to familiarize yourself with MS Visual Studio's Windows Form project. In the section of Pre-assignment below, two short tutorials are provided.

Pre-assignment

Assignment Instruction

You are about to create a GUI program with MS Visual Studio to approximate the value of PI by a simulation of dart throwing. The detailed procedure is given here.

The assignment can be broken into two tasks: Windows form creation and C# code behind. Upon completion, the Windows form allows the user to specify the darts to be thrown. When the start button is clicked, the simulation begins. On the form, display darts and target and the simulation of result of PI. An example form is given below.

The following are two functions you need to generate random numbers and calculate sqare root of a number.

//Create a Random object
Random randNum = new Random();

//Generate a random number
x = randNum.Next();

//Square root of a
Math.Sqrt(a);

You need to turn in your C# code (NOT entire project) and a screenshot of your Windows form with simulation results.