|
CS4 Employee Pay Calculator - 20 points |
|
This program will be used by employees to determine what their weekly net pay would be based on their hourly rate and number of hours worked.
Sample Form:
Requirements:
//CS4 by Your Name - CIS162AD
namespace CS4
{
public partial class CS4Form : Form
{
public CS4Form()
{
InitializeComponent();
}
//Declare class level variables (employee count and total netpay)
//Declare class level constants (see list above)
private void btnCalculate_Click(object sender, System.EventArgs e)
{
// declare method variables
//Use nested try-catch blocks to get the input values
//so we know which one caused the error
try
{
//Get hours worked from textbox
try
{
//Get pay rate from textbox
//Calculate gross amount
//Calculate taxes
//Calculate net pay
//Accumulate summary values
//Calculate average net pay
//Display results of calculations and summary values
}
catch (FormatException err)
{
MessageBox.Show("Pay Rate must be numeric. " + err.Message,
"Data Entry Error", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
txtRate.SelectAll();
txtRate.Focus();
}
}
catch (FormatException err)
{
MessageBox.Show("Hours worked must be numeric. " + err.Message,
"Data Entry Error", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
txtHours.SelectAll();
txtHours.Focus();
}
catch (Exception err)
{
MessageBox.Show("Unexpected Error: " + err.Message);
}
}//end method
private void btnClearForm_Click(object sender, EventArgs e)
{
//Use Clear or null string "" for TextBoxes, but
//only use null string "" for Labels
//Reset Accumulators
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}//end of class
}//end of namespace
Submit CS4Form.cs and CS4Form.Designer.cs