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 ConsoleApplication2
- {
- class Worker
- {
- protected int Id;
- protected string FIO;
- protected decimal Salary;
- protected decimal HoursPerWeek;
- protected decimal HoursPerMounth;
- public Worker(int id, string fio, decimal salary, decimal hoursperweek)
- {
- Id = id;
- FIO = fio;
- Salary = salary;
- HoursPerWeek = hoursperweek;
- HoursPerMounth = HoursPerWeek * 4;
- }
- public decimal GetSalaryPerHour()
- {
- decimal sph = Salary / HoursPerMounth;
- return sph;
- }
- public void Output()
- {
- Console.WriteLine(Id + " ФИО: " + FIO + ", Зарплата в месяц:" + Salary + ", Часов в неделю " + HoursPerWeek + ", Часов в месяц: " + HoursPerMounth+", зарплата в час "+ this.GetSalaryPerHour());
- }
- }
- --------------------------------------------------------------------------------------------------------------------------
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication2
- {
- class Boss : Worker
- {
- decimal BoxIndex;
- string Department;
- List<Worker> Slaves = new List<Worker>(5);
- public Boss(int id, string fio, decimal salary, decimal hpw, string dep):base(id, fio, salary,hpw)
- {
- Console.WriteLine("БОСС СОЗДАН!!!!!!!!!!!!!!");
- BoxIndex=0;
- Department = dep;
- Slaves.Add(new Worker(1, "ыв", 228, 30));
- Slaves.Add(new Worker(2, "sыв", 118, 10));
- Slaves.Add(new Worker(3, "wыв", 238, 20));
- Slaves.Add(new Worker(4, "dыв", 2258, 40));
- Slaves.Add(new Worker(5, "tыв", 2128, 50));
- }
- public void slavesalary()
- {
- foreach(var x in Slaves){
- Console.WriteLine(x.GetSalaryPerHour());
- }
- }
- public void GetBI()
- {
- foreach (var x in Slaves)
- {
- if (x.GetSalaryPerHour() >= 400)
- {
- BoxIndex += 3;
- }
- else
- {
- BoxIndex += (decimal)1.5;
- }
- }
- }
- public void Out()
- {
- Console.WriteLine("Вывод подчиненных без сортировки:");
- Console.WriteLine(Slaves);
- }
- public void Outws()
- {
- decimal asph=0;
- Console.WriteLine("С сортировкой:");
- foreach(var x in Slaves){
- asph+=x.GetSalaryPerHour();
- }
- asph/=5;
- }
- }
- }
- --------------------------------------------------------------------------------------------------------------------------
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication2
- {
- class Program
- {
- static void Main(string[] args)
- {
- Boss kek = new Boss(12, "sadboy", 2280000, 3, "kek");
- kek.GetBI();
- kek.slavesalary();
- kek.Out();
- kek.Outws();
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement