Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.83 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Kingston_Italiana
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Menu();
  14. }
  15.  
  16. public static void Menu()
  17. {
  18.  
  19. // Main Menu
  20. char ch;
  21. string Title = "**KINGSTON ITALANIA**\n\n";
  22.  
  23. Console.SetCursorPosition((Console.WindowWidth - Title.Length) / 3, Console.CursorTop);
  24. Console.WriteLine(Title);
  25.  
  26. Console.WriteLine("Welcome to Kingston Italiana. Here are your choices:\n\n");
  27.  
  28. Console.WriteLine("1 - Employee Details");
  29.  
  30. Console.WriteLine("\n2 - Pay Slip");
  31.  
  32. Console.WriteLine("\n3 - Help");
  33.  
  34. Console.WriteLine("\n4 - Exit Program");
  35.  
  36. Console.WriteLine("\n\nPlease select a choice from above using your keyboard:");
  37. ch = char.Parse(Console.ReadLine());
  38.  
  39. switch (ch)
  40. {
  41. // Employee Details
  42. case '1':
  43. string EmployeeName;
  44. string JobTitle;
  45. int Age;
  46. DateTime Date;
  47. int HoursWorked;
  48. int OverTime;
  49. double OverTimePay;
  50. double HourlyRate = 0;
  51. double Pay;
  52. double GrossPay;
  53. double TAX = 0;
  54. double NationalInsurance = 0;
  55. double NetPay;
  56. {
  57. Console.Clear();
  58. }
  59. // Title
  60. string Title2 = "**EMPLOYEE DETAILS**";
  61.  
  62. Console.SetCursorPosition((Console.WindowWidth - Title2.Length) / 4, Console.CursorTop);
  63. Console.WriteLine(Title2);
  64.  
  65. // Employee Name
  66. Console.WriteLine("\n\nEnter Employee Name:");
  67. EmployeeName = Console.ReadLine();
  68.  
  69. // Job Title
  70. Console.WriteLine("\nEnter Job Title:");
  71. JobTitle = Console.ReadLine();
  72.  
  73. if (JobTitle == "apprentice" && JobTitle == "Apprentice" && JobTitle == "APPRENTICE")
  74. {
  75. HourlyRate = 2.68;
  76. }
  77.  
  78. else
  79. // Age
  80. Console.WriteLine("\nEnter Age of Employee:");
  81. Age = Int32.Parse(Console.ReadLine());
  82.  
  83. if (Age >= 16 && Age < 18)
  84. {
  85. HourlyRate = 3.72;
  86. }
  87. else if (Age >= 18 && Age <= 20)
  88. {
  89. HourlyRate = 5.03;
  90. }
  91. else if (Age >= 21)
  92. {
  93. HourlyRate = 6.31;
  94. }
  95.  
  96. // Date
  97. Console.WriteLine("\nEnter the current Date (DD/MM/YYYY):");
  98. Date = DateTime.Parse(Console.ReadLine());
  99.  
  100. // Hours Worked
  101. Console.WriteLine("\nEnter amount of Hours worked during the week:");
  102. HoursWorked = Int32.Parse(Console.ReadLine());
  103.  
  104. if (HoursWorked > 56)
  105. {
  106. OverTime = HoursWorked - 56;
  107. }
  108.  
  109. else
  110. {
  111. OverTime = 0;
  112. }
  113. OverTimePay = (OverTime * HourlyRate);
  114. Pay = (HoursWorked * HourlyRate) + (OverTime * HourlyRate);
  115. GrossPay = (Pay * 52); // Calculate Pay for a Year
  116.  
  117. if (GrossPay <= 8632)
  118. {
  119. NationalInsurance = GrossPay * 0;
  120. }
  121. else if (GrossPay > 8632 && GrossPay <= 50000)
  122. {
  123. NationalInsurance = GrossPay * 0.12;
  124. }
  125. else if (GrossPay > 50000)
  126. {
  127. NationalInsurance = GrossPay * 0.2;
  128. }
  129. if (GrossPay <= 12500)
  130. {
  131. TAX = GrossPay * 0;
  132. }
  133. else if (GrossPay > 12501 && GrossPay <= 50000)
  134. {
  135. TAX = GrossPay * 0.2;
  136. }
  137. else if (GrossPay >= 50001 && GrossPay <= 150000)
  138. {
  139. TAX = GrossPay * 0.4;
  140. }
  141. NetPay = GrossPay - (TAX - NationalInsurance);
  142.  
  143. // Go back to Main Menu
  144. Console.WriteLine("\nPress any key to go back to the Main Menu.");
  145. Console.ReadKey();
  146. Console.Clear();
  147. Menu();
  148.  
  149. break;
  150. case '2':
  151. {
  152. Console.Clear();
  153. }
  154.  
  155. // Go back to Main Menu
  156. Console.WriteLine("\n\nPress any key to go back to the Main Menu.");
  157. Console.ReadKey();
  158. Console.Clear();
  159. Menu();
  160. break;
  161.  
  162. // Help Page
  163. case '3':
  164. {
  165. Console.Clear();
  166. }
  167. string Title3 = "**HELP PAGE**\n\n";
  168. Console.SetCursorPosition((Console.WindowWidth - Title3.Length) / 2, Console.CursorTop);
  169. Console.WriteLine(Title3);
  170.  
  171. 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");
  172. Console.WriteLine("Ultimately, this program will output the Employee Details, Gross Pay, TAX, National Insurance and Net Pay.\n");
  173.  
  174. // Go back to Main Menu
  175. Console.WriteLine("\n\nPress any key to go back to the Main Menu.");
  176. Console.ReadKey();
  177. Console.Clear();
  178. Menu();
  179.  
  180. break;
  181.  
  182. // Closing the Programming
  183. case '4':
  184. Environment.Exit(0);
  185.  
  186. break;
  187. }
  188. }
  189. }
  190. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement