i need to do the second part of the assignment
and i cant solve it, i need to do it gui,
this is what i have so far
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();
}
int id;
double wage;
// Employee[] emp = new Employee[10];
double[] emp = new double[10];
private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < 10; i++)
{
id = Convert.ToInt32(Console.ReadLine());
wage = Convert.ToDouble(Console.ReadLine());
}
//display data
label6.Text = ("Display Employee Details\n");
label6.Text = ("IDNumber HourlyWage");
for (int i = 0; i < 10; i++)
//emp[i].show();
emp[0] = Convert.ToDouble(textBox1.Text);
emp[1] = Convert.ToDouble(textBox2.Text);
emp[2] = Convert.ToDouble(textBox3.Text);
emp[3] = Convert.ToDouble(textBox4.Text);
emp[4] = Convert.ToDouble(textBox5.Text);
emp[5] = Convert.ToDouble(textBox6.Text);
emp[6] = Convert.ToDouble(textBox7.Text);
emp[7] = Convert.ToDouble(textBox8.Text);
emp[8] = Convert.ToDouble(textBox9.Text);
emp[9] = Convert.ToDouble(textBox10.Text);
}
class Employee
{
//declaration
int IDNum;
double hourlyWage;
//no argument constructor
public Employee()
{
}
//two argument cunstructor
public Employee(int id, double hw)
{
try
{
IDNum = id;
if (hw < 6 || hw > 50)//input validation
//throwing exception
throw new ArgumentException("Invalid Value", "hourlyWage");
else
{
Console.WriteLine("Employee Object Created Successfully");
hourlyWage = hw;
}
}
catch (ArgumentException ae)
{
//handling exception
IDNum = 999;
hourlyWage = 6.0;
Console.WriteLine(ae.Message);
}
}
//show data
public void show()
{
Console.WriteLine(IDNum + "\t" + hourlyWage);
}
}
}
}