Advertisement
remote87

Month Salary

Oct 24th, 2015
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.64 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. using System.Globalization;
  7.  
  8. namespace MonthPayment
  9. {
  10.     class MonthPayment
  11.     {
  12.         static void Main()
  13.         {
  14.             Console.Write("Въведи брой работници: ");
  15.             int workersCount = int.Parse(Console.ReadLine());
  16.             int workDays = 0;
  17.             int leave = 1;
  18.             int hospital = 1;
  19.             int advance = 0;
  20.             int paymentMotnhAll = 0;
  21.  
  22.             Console.Write("\nМоля въведете заплащане на ден: ");
  23.             int paymentPerDay = int.Parse(Console.ReadLine());
  24.            
  25.             Console.Write("\nМоля въведете заплащане на ден за отпуск: ");
  26.             int paymentDayLeave = int.Parse(Console.ReadLine());
  27.  
  28.             Console.Write("\nМоля въведете заплащане на ден за болничен: ");
  29.             int paymentDayHospital = int.Parse(Console.ReadLine());
  30.  
  31.             int paymentLeave = 0;
  32.             int paymentHospital = 0;
  33.             int salary = 0;
  34.  
  35.             List<string> workerName = new List<string>();
  36.             List<int> montPayment = new List<int>();
  37.  
  38.             for (int i = 0; i < workersCount; i++)
  39.             {
  40.                 Console.Write("\nВъведи име на работник: ");
  41.                 workerName.Add(Console.ReadLine());
  42.                 Console.Write("Въведи работни дни: ");
  43.                 workDays = int.Parse(Console.ReadLine());
  44.                 Console.Write("Ползвал ли е работника отпуска: Да/Не: ");
  45.                 string answear1 = Console.ReadLine();
  46.                 if (answear1.ToLower() == "да")
  47.                 {
  48.                     Console.Write("Въведете брой дни отпуска: ");
  49.                     leave = int.Parse(Console.ReadLine());
  50.                     paymentLeave = leave * paymentDayLeave;
  51.                 }
  52.                
  53.                 Console.Write("Ползвал ли е работника болнични: Да/Не: ");
  54.                 string answear2 = Console.ReadLine();
  55.                 if (answear2.ToLower() == "да")
  56.                 {
  57.                     Console.Write("Въведете брой дни болнични: ");
  58.                     hospital = int.Parse(Console.ReadLine());
  59.                     paymentHospital = hospital * paymentDayHospital;
  60.                 }
  61.                 Console.Write("Работника вземал ли е аванс: Да/Не: ");
  62.                 string answear3 = Console.ReadLine();
  63.                 if (answear3.ToLower() == "да")
  64.                 {
  65.                     Console.Write("Въведете сума за аванс: ");
  66.                     advance = int.Parse(Console.ReadLine());
  67.                 }
  68.                 paymentMotnhAll = workDays * paymentPerDay;
  69.                 salary = paymentMotnhAll - paymentLeave - paymentHospital;
  70.                 if (salary < 0)
  71.                 {
  72.                     salary = 0;
  73.                 }
  74.                 montPayment.Add(salary);
  75.                 Console.WriteLine();
  76.                
  77.             }
  78.             for (int j = 0; j < workerName.Count; j++)
  79.             {
  80.                 Console.Write("Работник: {0}; Заплата {1}", workerName[j], montPayment[j]);
  81.                 Console.WriteLine();
  82.             }
  83.            
  84.             int total = montPayment.Sum();
  85.             Console.WriteLine("Заплати за месеца тотал: {0}.", total);
  86.         }
  87.     }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement