Guest User

Untitled

a guest
Jul 18th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.47 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3.  
  4. namespace Employees
  5. {
  6. /*
  7. internal enum Proffesion
  8. {
  9. Accountant = 1,
  10. Seamstress,
  11. Seller
  12. }
  13. enum typeSalary
  14. {
  15. Hourly = 1,
  16. Daily
  17. }
  18. */
  19.  
  20. /* class Employe
  21. {
  22. private Proffesion prof;
  23. private typeSalary typesal;
  24. private int salaryRate;
  25. private int ID;
  26. }
  27.  
  28. class TimeEmploye
  29. {
  30. private int ID;
  31. private int hoursWorked;
  32. }*/
  33.  
  34.  
  35. static class Program
  36. {
  37.  
  38.  
  39. static void Main()
  40. {
  41. decimal s = 0;
  42. bool f = false;
  43. /*ArrayList in1 = new ArrayList();
  44. ArrayList in2 = new ArrayList();
  45. int el;
  46. while (!f)
  47. {
  48.  
  49. el = Int32.Parse(Console.ReadLine());
  50. in1.Add(el);
  51. if (el == -1)
  52. {
  53. f = true;
  54. }
  55. }
  56.  
  57. while (f)
  58. {
  59. el = Int32.Parse(Console.ReadLine());
  60. in2.Add(el);
  61.  
  62. if (el == -1)
  63. {
  64. f = false;
  65. }
  66.  
  67. }
  68.  
  69. int[] arr1 = (int[]) in1.ToArray(typeof(int));
  70. int[] arr2 = (int[]) in2.ToArray(typeof(int));*/
  71.  
  72. int[] arr1 = new int[]{1, 1, 10, 1, 2, 1, 8, 2, 2, 2, 100, 3, 3, 1, 15, 4, -1};
  73. int[] arr2 = new[] {1, 250, 2, 300, 3, 245, 4, 100, 4, 50, -1};
  74.  
  75. for (int i = 0; i < arr1.Length-1; i += 4)
  76. {
  77. // [0] - proff
  78. // [1] - zp typesalary
  79. // [2] - salary rate
  80. // [3] - id
  81. Console.Write(" { " + arr1[i+3] + " } " );
  82.  
  83.  
  84.  
  85.  
  86. for (int j = 0; j < arr2.Length-1; j += 2)
  87. {
  88. if (arr1[i + 3] == arr2[j])
  89. {
  90. if (arr1[i] == 1)
  91. {
  92.  
  93. if (arr1[i + 1] == 1)
  94. {
  95. decimal salary = arr1[i + 2] * arr2[j + 1];
  96. Console.Write("Salary: " + salary + " + ");
  97. s = s + salary;
  98. }
  99. else
  100. {
  101. decimal value = arr2[j + 1] / 24;
  102.  
  103. var salary = arr1[i + 2] * Math.Round(value);
  104. Console.Write("Salary: " + salary + " + ");
  105. s = s + salary;
  106. }
  107.  
  108. //S = S + ();
  109. }
  110.  
  111. if (arr1[i] == 2)
  112. {
  113. if (arr1[i + 1] == 1)
  114. {
  115. decimal value = arr2[j + 1] / 24;
  116.  
  117. decimal salary = arr1[i + 2] * arr2[j + 1];
  118. //value = arr2[j + 1] / 24;
  119. var bonus = Math.Round(value) * salary * (decimal) 0.01;
  120. Console.Write("Salary: " + salary + " ");
  121. Console.Write("Bonus: " + bonus + " ");
  122. salary += bonus;
  123. //Console.Write(salary + " + ");
  124. s = s + salary ;
  125.  
  126. }
  127. else
  128. {
  129. decimal value = arr2[j + 1] / 24;
  130.  
  131. //decimal value = arr2[j + 1] / 24;
  132. decimal salary = (arr1[i + 2] * arr2[j + 1]);
  133. var bonus = Math.Round(value) * salary * (decimal) 0.01;
  134. Console.Write("Salary: " + salary + " ");
  135. Console.Write("Bonus: " + bonus + " ");
  136. salary += bonus;
  137. //Console.Write(salary + " + ");
  138. s = s + salary;
  139.  
  140. }
  141. }
  142.  
  143. if (arr1[i] == 3)
  144. {
  145. if (arr1[i + 1] == 1)
  146. {
  147. decimal salary = arr1[i + 2] * arr2[j + 1];
  148. var bonus = salary * (decimal) 0.01;
  149. Console.Write("Salary: " + salary + " ");
  150. Console.Write("Bonus: " + bonus + " ");
  151. salary += bonus;
  152. //Console.Write(salary + " + ");
  153. s = s + salary;
  154.  
  155. }
  156. else
  157. {
  158. decimal salary = (arr1[i + 2] * arr2[j + 1]);
  159. var bonus = salary * (decimal) 0.01;
  160. Console.Write("Salary: " + salary + " ");
  161. Console.Write("Bonus: " + bonus + " ");
  162. salary += bonus;
  163. //Console.Write(salary + " + ");
  164. s = s + salary;
  165.  
  166. }
  167.  
  168. }
  169.  
  170. }
  171.  
  172. }
  173. }
  174.  
  175. Console.Write(" = " + s);
  176. }
  177. }
  178. }
Add Comment
Please, Sign In to add comment