I am trying to solve the second part of this question this is what i came so far
i do it on GUI and when i push the button nothing happend
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace EmployeeExceptionDemo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
double[] myArray = new double[5];
private void button1_Click(object sender, EventArgs e)
{
try
{
myArray[0] = Convert.ToDouble(textBox1.Text) + Convert.ToDouble(textBox2.Text);
myArray[1] = Convert.ToDouble(textBox3.Text) + Convert.ToDouble(textBox4.Text);
myArray[2] = Convert.ToDouble(textBox5.Text) + Convert.ToDouble(textBox6.Text);
myArray[3] = Convert.ToDouble(textBox7.Text) + Convert.ToDouble(textBox8.Text);
myArray[4] = Convert.ToDouble(textBox9.Text) + Convert.ToDouble(textBox10.Text);
}
catch (Exception ex)
{
label6.Text = (ex.Message);
}
}
class Employee
{
public int idNum = 999;
public double hourlyrate = 6;
public Employee(int idNumber, double emprate)
{
idNum = idNumber;
if (emprate < 6 || emprate > 50)
{
throw new ArgumentException("Value does not fall within the expected range.");
}
else
hourlyrate = emprate;
}
}
}
}