Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 WindowsFormsApplication3
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- string SalShow;
- String HoursSumShow;
- //User veriables imput
- int lowShiftStt = 0;
- int MidShiftStt = 0;
- int LongShiftStt = 0;
- //Security Guard salary rates
- const int LowSal = 27;
- const double MidSal = 33.25;
- const double HighSal = 45.5;
- //Achmash Salary rates
- const int AchmashLowSal = 30;
- const double AchmashMidSal = 37.5;
- const int AchmashHighSal = 45;
- //Security guard shift hours
- const int LowShift = 8;
- const double MidShift = 10.4;
- const double LongShift = 12.4;
- //Achmash Shift Hours
- const double AchmashLowShift = 8.15;
- const double AchmashHighShift = 9.30;
- //Salary calculation
- double LowSalSum = 0;
- double MidSalSum = 0;
- Double HighSalSum = 0;
- double SecGuardSalarySum = 0;
- double ShiftHoursSum = 0;
- lowShiftStt = int.Parse(textBox1.Text);
- MidShiftStt = int.Parse(textBox2.Text);
- LongShiftStt = int.Parse(textBox3.Text);
- //If the user didn't fill the forms correctly
- if(lowShiftStt )
- {
- MessageBox.Show ("Please Fill all forms!");
- }
- //Calculation of the salary and working hours
- ShiftHoursSum = (LowShift * lowShiftStt) + (MidShift * lowShiftStt) + (LongShift * LongShiftStt);
- LowSalSum = ((LowSal * 8) * lowShiftStt);
- MidSalSum = ((LowSal * 8 + MidSal * 2) * MidShiftStt);
- HighSalSum = ((LowSal * 8 + MidSal * 2) + (HighSal * 2) * MidShiftStt);
- SecGuardSalarySum = LowSalSum + MidSalSum + HighSalSum;
- SalShow = "Earnings: ";
- HoursSumShow = "Hours summary: ";
- SalDisplay.Text = SalShow + (SecGuardSalarySum.ToString());
- HoursSum.Text = HoursSumShow + (ShiftHoursSum.ToString());
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- }
- private void textBox2_TextChanged(object sender, EventArgs e)
- {
- }
- private void label5_Click(object sender, EventArgs e)
- {
- }
- private void label4_Click(object sender, EventArgs e)
- {
- }
- private void label7_Click(object sender, EventArgs e)
- {
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void SalDisplay_Click(object sender, EventArgs e)
- {
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- //Switching Lables between Achmash and security guard
- switch (comboBox1.SelectedItem.ToString())
- {
- case "Normal Rates":
- label1.Text = "8 Hour(s): ";
- label2.Text = "10.4 Hour(s): ";
- label3.Text = "6.2 Hour(s): ";
- break;
- case "Achmash Rates":
- label1.Text = "8.15 Hour(s): ";
- label2.Text = "9.30 Hour(s): ";
- label3.Text = "8 Hour(s): ";
- break;
- }
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment