Guest User

Untitled

a guest
Sep 17th, 2012
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.98 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace WindowsFormsApplication3
  11. {
  12.     public partial class Form1 : Form
  13.     {
  14.         public Form1()
  15.         {
  16.             InitializeComponent();
  17.         }
  18.  
  19.         private void button1_Click(object sender, EventArgs e)
  20.         {
  21.             string SalShow;
  22.             String HoursSumShow;
  23.             //User veriables imput
  24.             int lowShiftStt = 0;
  25.             int MidShiftStt = 0;
  26.             int LongShiftStt = 0;
  27.             //Security Guard salary rates
  28.             const int LowSal = 27;
  29.             const double MidSal = 33.25;
  30.             const double HighSal = 45.5;
  31.             //Achmash Salary rates
  32.             const int AchmashLowSal = 30;
  33.             const double AchmashMidSal = 37.5;
  34.             const int AchmashHighSal = 45;
  35.             //Security guard shift hours
  36.             const int LowShift = 8;
  37.             const double MidShift = 10.4;
  38.             const double LongShift = 12.4;
  39.             //Achmash Shift Hours
  40.             const double AchmashLowShift = 8.15;
  41.             const double AchmashHighShift = 9.30;
  42.             //Salary calculation
  43.             double LowSalSum = 0;
  44.             double MidSalSum = 0;
  45.             Double HighSalSum = 0;
  46.             double SecGuardSalarySum = 0;
  47.             double ShiftHoursSum = 0;
  48.            
  49.                 lowShiftStt = int.Parse(textBox1.Text);
  50.                 MidShiftStt = int.Parse(textBox2.Text);
  51.                 LongShiftStt = int.Parse(textBox3.Text);
  52.  
  53.                 //If the user didn't fill the forms correctly
  54.             if(lowShiftStt )
  55.             {
  56.                 MessageBox.Show ("Please Fill all forms!");
  57.             }
  58.             //Calculation of the salary and working hours
  59.             ShiftHoursSum = (LowShift * lowShiftStt) + (MidShift * lowShiftStt) + (LongShift * LongShiftStt);
  60.             LowSalSum = ((LowSal * 8) * lowShiftStt);
  61.             MidSalSum = ((LowSal * 8 + MidSal * 2) * MidShiftStt);
  62.             HighSalSum = ((LowSal * 8 + MidSal * 2) + (HighSal * 2) * MidShiftStt);
  63.             SecGuardSalarySum = LowSalSum + MidSalSum + HighSalSum;
  64.             SalShow = "Earnings: ";
  65.             HoursSumShow = "Hours summary: ";
  66.             SalDisplay.Text = SalShow + (SecGuardSalarySum.ToString());
  67.             HoursSum.Text = HoursSumShow + (ShiftHoursSum.ToString());
  68.            
  69.         }
  70.  
  71.         private void textBox1_TextChanged(object sender, EventArgs e)
  72.         {
  73.  
  74.         }
  75.  
  76.         private void textBox2_TextChanged(object sender, EventArgs e)
  77.         {
  78.  
  79.         }
  80.  
  81.         private void label5_Click(object sender, EventArgs e)
  82.         {
  83.  
  84.         }
  85.  
  86.         private void label4_Click(object sender, EventArgs e)
  87.         {
  88.  
  89.         }
  90.  
  91.         private void label7_Click(object sender, EventArgs e)
  92.         {
  93.  
  94.         }
  95.  
  96.         private void Form1_Load(object sender, EventArgs e)
  97.         {
  98.  
  99.         }
  100.  
  101.         private void SalDisplay_Click(object sender, EventArgs e)
  102.         {
  103.  
  104.         }
  105.  
  106.         private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  107.         {
  108.             //Switching Lables between Achmash and security guard
  109.             switch (comboBox1.SelectedItem.ToString())
  110.             {
  111.                 case "Normal Rates":
  112.                     label1.Text = "8 Hour(s): ";
  113.                     label2.Text = "10.4 Hour(s): ";
  114.                     label3.Text = "6.2 Hour(s): ";
  115.                    
  116.                     break;
  117.  
  118.                 case "Achmash Rates":
  119.                     label1.Text = "8.15 Hour(s): ";
  120.                     label2.Text = "9.30 Hour(s): ";
  121.                     label3.Text = "8 Hour(s): ";
  122.                    
  123.                     break;
  124.             }
  125.            
  126.         }
  127.  
  128.         private void label1_Click(object sender, EventArgs e)
  129.         {
  130.  
  131.         }
  132.    
  133.     }
  134. }
Advertisement
Add Comment
Please, Sign In to add comment