private void btnSubmit_Click(object sender, EventArgs e) { int[] array; int n = Convert.ToInt16(textBoxNumber.Text); Test oTest = new Test(); if (oTest.Testn(n)) { ChrisClass cClass = new ChrisClass(); array = cClass.GetRandomNumbers(n); stat oStat = new stat(); MessageBox.Show("Minimum random number: " + oStat.minimumRandom(array, n)); } else { Exception ex = new Exception("Please enter a number between 5 and 20"); throw ex; } }
private void button1_Click(object sender, EventArgs e) { int iInputValue = 0; // inputted value AugustoClass oClass = new AugustoClass(); // class containing random method generater Test oTest = new Test(); // test class containing test for between 5 and 20 stat oStat = new stat(); // stat class containing stat method iInputValue = Convert.ToInt16(textBox2.Text); if (oTest.Testn(iInputValue)) { int[] list = oClass.GetRandomArray(iInputValue); int iMedian = oStat.GetMedian(list); MessageBox.Show("Median is:" + iMedian); } else { MessageBox.Show("Input a value between 5 and 20"); } }
private void button1_Click(object sender, EventArgs e) { Test testNum = new Test(); bool mardus; mardus = testNum.Testn(Convert.ToInt16(ranAmount.Text)); int gCD; MardusClass myClass = new MardusClass(); if (mardus == true) { int[] list = myClass.getRandom(Convert.ToInt16(ranAmount.Text)); Answers.Clear(); int checkSpace; for (int i = 0; i < list.Length; i++) { Answers.AppendText(Convert.ToString(list[i] + " ")); checkSpace = i % 5; if (checkSpace == 0) { Answers.AppendText("\n"); } } stat tstNums = new stat(); gCD = tstNums.GCD(list); MessageBox.Show(Convert.ToString("The greatest CD is: " + gCD)); } else { MessageBox.Show("Please make sure that the number that was entered is betwwen 5 and 20"); } }