Advertisement
Guest User

Untitled

a guest
Apr 9th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.56 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 ConsoleApplication2
  8. {
  9. class Worker
  10. {
  11. protected int Id;
  12. protected string FIO;
  13. protected decimal Salary;
  14. protected decimal HoursPerWeek;
  15. protected decimal HoursPerMounth;
  16. public Worker(int id, string fio, decimal salary, decimal hoursperweek)
  17. {
  18. Id = id;
  19. FIO = fio;
  20. Salary = salary;
  21. HoursPerWeek = hoursperweek;
  22. HoursPerMounth = HoursPerWeek * 4;
  23. }
  24. public decimal GetSalaryPerHour()
  25. {
  26. decimal sph = Salary / HoursPerMounth;
  27. return sph;
  28. }
  29. public void Output()
  30. {
  31. Console.WriteLine(Id + " ФИО: " + FIO + ", Зарплата в месяц:" + Salary + ", Часов в неделю " + HoursPerWeek + ", Часов в месяц: " + HoursPerMounth+", зарплата в час "+ this.GetSalaryPerHour());
  32. }
  33. }
  34. --------------------------------------------------------------------------------------------------------------------------
  35. }
  36. using System;
  37. using System.Collections.Generic;
  38. using System.Linq;
  39. using System.Text;
  40. using System.Threading.Tasks;
  41.  
  42. namespace ConsoleApplication2
  43. {
  44. class Boss : Worker
  45. {
  46. decimal BoxIndex;
  47. string Department;
  48. List<Worker> Slaves = new List<Worker>(5);
  49. public Boss(int id, string fio, decimal salary, decimal hpw, string dep):base(id, fio, salary,hpw)
  50. {
  51. Console.WriteLine("БОСС СОЗДАН!!!!!!!!!!!!!!");
  52. BoxIndex=0;
  53. Department = dep;
  54. Slaves.Add(new Worker(1, "ыв", 228, 30));
  55. Slaves.Add(new Worker(2, "sыв", 118, 10));
  56. Slaves.Add(new Worker(3, "wыв", 238, 20));
  57. Slaves.Add(new Worker(4, "dыв", 2258, 40));
  58. Slaves.Add(new Worker(5, "tыв", 2128, 50));
  59. }
  60. public void slavesalary()
  61. {
  62. foreach(var x in Slaves){
  63. Console.WriteLine(x.GetSalaryPerHour());
  64. }
  65. }
  66. public void GetBI()
  67. {
  68. foreach (var x in Slaves)
  69. {
  70. if (x.GetSalaryPerHour() >= 400)
  71. {
  72. BoxIndex += 3;
  73. }
  74. else
  75. {
  76. BoxIndex += (decimal)1.5;
  77. }
  78. }
  79. }
  80. public void Out()
  81. {
  82. Console.WriteLine("Вывод подчиненных без сортировки:");
  83. Console.WriteLine(Slaves);
  84.  
  85. }
  86. public void Outws()
  87. {
  88. decimal asph=0;
  89. Console.WriteLine("С сортировкой:");
  90. foreach(var x in Slaves){
  91. asph+=x.GetSalaryPerHour();
  92. }
  93. asph/=5;
  94. }
  95. }
  96. }
  97.  
  98. --------------------------------------------------------------------------------------------------------------------------
  99.  
  100. using System;
  101. using System.Collections.Generic;
  102. using System.Linq;
  103. using System.Text;
  104. using System.Threading.Tasks;
  105.  
  106. namespace ConsoleApplication2
  107. {
  108. class Program
  109. {
  110. static void Main(string[] args)
  111. {
  112. Boss kek = new Boss(12, "sadboy", 2280000, 3, "kek");
  113. kek.GetBI();
  114. kek.slavesalary();
  115. kek.Out();
  116. kek.Outws();
  117. Console.ReadKey();
  118. }
  119. }
  120. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement