Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Kingston_Italiana
- {
- class Program
- {
- static void Main(string[] args)
- {
- Menu();
- }
- public static void Menu()
- {
- // Main Menu
- char ch;
- string Title = "**KINGSTON ITALANIA**\n\n";
- Console.SetCursorPosition((Console.WindowWidth - Title.Length) / 3, Console.CursorTop);
- Console.WriteLine(Title);
- Console.WriteLine("Welcome to Kingston Italiana. Here are your choices:\n\n");
- Console.WriteLine("1 - Employee Details");
- Console.WriteLine("\n2 - Pay Slip");
- Console.WriteLine("\n3 - Help");
- Console.WriteLine("\n4 - Exit Program");
- Console.WriteLine("\n\nPlease select a choice from above using your keyboard:");
- ch = char.Parse(Console.ReadLine());
- switch (ch)
- {
- // Employee Details
- case '1':
- string EmployeeName;
- string JobTitle;
- int Age;
- DateTime Date;
- int HoursWorked;
- int OverTime;
- double OverTimePay;
- double HourlyRate = 0;
- double Pay;
- double GrossPay;
- double TAX = 0;
- double NationalInsurance = 0;
- double NetPay;
- {
- Console.Clear();
- }
- // Title
- string Title2 = "**EMPLOYEE DETAILS**";
- Console.SetCursorPosition((Console.WindowWidth - Title2.Length) / 4, Console.CursorTop);
- Console.WriteLine(Title2);
- // Employee Name
- Console.WriteLine("\n\nEnter Employee Name:");
- EmployeeName = Console.ReadLine();
- // Job Title
- Console.WriteLine("\nEnter Job Title:");
- JobTitle = Console.ReadLine();
- if (JobTitle == "apprentice" && JobTitle == "Apprentice" && JobTitle == "APPRENTICE")
- {
- HourlyRate = 2.68;
- }
- else
- // Age
- Console.WriteLine("\nEnter Age of Employee:");
- Age = Int32.Parse(Console.ReadLine());
- if (Age >= 16 && Age < 18)
- {
- HourlyRate = 3.72;
- }
- else if (Age >= 18 && Age <= 20)
- {
- HourlyRate = 5.03;
- }
- else if (Age >= 21)
- {
- HourlyRate = 6.31;
- }
- // Date
- Console.WriteLine("\nEnter the current Date (DD/MM/YYYY):");
- Date = DateTime.Parse(Console.ReadLine());
- // Hours Worked
- Console.WriteLine("\nEnter amount of Hours worked during the week:");
- HoursWorked = Int32.Parse(Console.ReadLine());
- if (HoursWorked > 56)
- {
- OverTime = HoursWorked - 56;
- }
- else
- {
- OverTime = 0;
- }
- OverTimePay = (OverTime * HourlyRate);
- Pay = (HoursWorked * HourlyRate) + (OverTime * HourlyRate);
- GrossPay = (Pay * 52); // Calculate Pay for a Year
- if (GrossPay <= 8632)
- {
- NationalInsurance = GrossPay * 0;
- }
- else if (GrossPay > 8632 && GrossPay <= 50000)
- {
- NationalInsurance = GrossPay * 0.12;
- }
- else if (GrossPay > 50000)
- {
- NationalInsurance = GrossPay * 0.2;
- }
- if (GrossPay <= 12500)
- {
- TAX = GrossPay * 0;
- }
- else if (GrossPay > 12501 && GrossPay <= 50000)
- {
- TAX = GrossPay * 0.2;
- }
- else if (GrossPay >= 50001 && GrossPay <= 150000)
- {
- TAX = GrossPay * 0.4;
- }
- NetPay = GrossPay - (TAX - NationalInsurance);
- // Go back to Main Menu
- Console.WriteLine("\nPress any key to go back to the Main Menu.");
- Console.ReadKey();
- Console.Clear();
- Menu();
- break;
- case '2':
- {
- Console.Clear();
- }
- // Go back to Main Menu
- Console.WriteLine("\n\nPress any key to go back to the Main Menu.");
- Console.ReadKey();
- Console.Clear();
- Menu();
- break;
- // Help Page
- case '3':
- {
- Console.Clear();
- }
- string Title3 = "**HELP PAGE**\n\n";
- Console.SetCursorPosition((Console.WindowWidth - Title3.Length) / 2, Console.CursorTop);
- Console.WriteLine(Title3);
- Console.WriteLine("This is the help page of Kingston Italiana. This program is about calculating the pay of an Employee. The first thing to do in this program is to input the Employee Details for calculating the pay. After that a PaySlip will be generated based upon the details inputted upon the Employee.\n\n");
- Console.WriteLine("Ultimately, this program will output the Employee Details, Gross Pay, TAX, National Insurance and Net Pay.\n");
- // Go back to Main Menu
- Console.WriteLine("\n\nPress any key to go back to the Main Menu.");
- Console.ReadKey();
- Console.Clear();
- Menu();
- break;
- // Closing the Programming
- case '4':
- Environment.Exit(0);
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement