Question: In C# please create the design.cs for this Form1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks;

In C# please create the design.cs for this Form1.cs

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;

namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }

private void button1_Click(object sender, EventArgs e) { try { double sum=0, avg=0, smallest; // getting series of number from text box // and store it into string string s = textBox1.Text; // seperate all numbers using split function string[] s2 = s.Split(','); // creating double array double[] series=new double[s2.Length]; for (int i = 0; i < s2.Length; i++) { // convert all string format numbers to double // and store them into double array series[i]=Convert.ToDouble(s2[i]); } smallest = series[0]; for (int i = 0; i < series.Length; i++) { // find smallest number if (smallest > series[i]) smallest = series[i]; // calculate sum sum = sum + series[i]; } //calculate average avg = sum / series.Length; // display output in text boxes textBox2.Text = sum.ToString(); textBox3.Text = Math.Round(avg,2).ToString(); textBox4.Text = smallest.ToString(); } catch (Exception) { // if any invalid input is entered by user MessageBox.Show("Invalid series of number...!!!"); } }

private void button2_Click(object sender, EventArgs e) { // clears all text boxes textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!