MCC - Marquez - CIS162AD
CS5 Pay Calculator with Decisions - 25 points
   cs.gif

In this program CS4 Pay Calculator will be enhanced to use If statements to valid the data entered, calculate overtime, and to determine the union dues based on the employee's membership. Radio Buttons will be used to allow the user to select their memberhship type. In addition, images will be added using Picture Boxes to enhance the appearance of the form :-).

Sample Form:

Sample Output (cs5_interface.jpg)

Requirements:

Pseudocode for calculate button:
//CS5 by Your Name - CIS162AD
/*
  	Enter program description here
*/

namespace CS5
{
  public partial class CS5Form : Form
  (
     public CS5Form()
     {
        InitializeComponent();
     }
	 
     //Declare class level variables (employee count and total netpay) 
     //Declare class level constants (see list above) 
     
     private void btnCalculate_Click(object sender, EventArgs e) 
     { 
         // declare method variables 
         
         try 
         { 
            //Use a try-catch block to catch non-numeric values

            //Get value for hours
            //Get value for pay rate

            //if statement to validate hours
                //if statement to validate pay rate                
                  {
                      //We have valid Hours and PayRate - continue processing.
                      //if statement to determine if overtime rate should be applied for gross
                      //Calculate taxes
                      //if statement to set Union Dues variable - check radio buttons
                      //Calculate netpay by subtracting tax and union due amounts from gross
                      //Accumulate summary totals
                      //Calculate Average NetPay
                      //Display the values in labels
					  //Set focus on hours so user is ready to enter next employee
                   }
                   else
                   {
                        MessageBox.Show("Pay Rate must be between $10.00 and $15.00. ", 
                            "Data Entry Error", MessageBoxButtons.OK, 
                            MessageBoxIcon.Exclamation);
                        txtRate.SelectAll();
                        txtRate.Focus();
                   }
               else
               {
                    MessageBox.Show("Hours must be between 1 and 50. ",
                        "Data Entry Error", MessageBoxButtons.OK, 
                        MessageBoxIcon.Exclamation);
                    txtHours.SelectAll();
                    txtHours.Focus();
               }
          }
          //Handle exceptions for Hours and Payrate
          catch (FormatException err)
          {
                MessageBox.Show("Hours or Payrate not numeric. " + err.Message,
                    "Data Entry Error", MessageBoxButtons.OK, 
                    MessageBoxIcon.Exclamation);
                txtHours.SelectAll();
                txtHours.Focus();
          }
          catch (Exception err) 
          {
                MessageBox.Show("Unexpected Error: " + err.Message);
          }
     }//end of btnCalculate

     
     private void btnClearForm_Click(object sender, EventArgs e)
     {
         //Use Clear or null string "" for TextBoxes, but
         //only use null string "" for Labels

         //Set radNone.Checked = true;
         //Reset Accumulators
 
     }//end of btnClearForm


     private void btnExit_Click(object sender, EventArgs e)
     {
         this.Close();
     }


  }//end of class
}//end of namespace

Submit CS5Form.cs and CS5Form.Designer.cs


Revised: 08/15/2008 - www.mc.maricopa.edu/~marquez/cis162ad/cs5_decisions.html