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;
- using System.Globalization;
- namespace MonthPayment
- {
- class MonthPayment
- {
- static void Main()
- {
- Console.Write("Въведи брой работници: ");
- int workersCount = int.Parse(Console.ReadLine());
- int workDays = 0;
- int leave = 1;
- int hospital = 1;
- int advance = 0;
- int paymentMotnhAll = 0;
- Console.Write("\nМоля въведете заплащане на ден: ");
- int paymentPerDay = int.Parse(Console.ReadLine());
- Console.Write("\nМоля въведете заплащане на ден за отпуск: ");
- int paymentDayLeave = int.Parse(Console.ReadLine());
- Console.Write("\nМоля въведете заплащане на ден за болничен: ");
- int paymentDayHospital = int.Parse(Console.ReadLine());
- int paymentLeave = 0;
- int paymentHospital = 0;
- int salary = 0;
- List<string> workerName = new List<string>();
- List<int> montPayment = new List<int>();
- for (int i = 0; i < workersCount; i++)
- {
- Console.Write("\nВъведи име на работник: ");
- workerName.Add(Console.ReadLine());
- Console.Write("Въведи работни дни: ");
- workDays = int.Parse(Console.ReadLine());
- Console.Write("Ползвал ли е работника отпуска: Да/Не: ");
- string answear1 = Console.ReadLine();
- if (answear1.ToLower() == "да")
- {
- Console.Write("Въведете брой дни отпуска: ");
- leave = int.Parse(Console.ReadLine());
- paymentLeave = leave * paymentDayLeave;
- }
- Console.Write("Ползвал ли е работника болнични: Да/Не: ");
- string answear2 = Console.ReadLine();
- if (answear2.ToLower() == "да")
- {
- Console.Write("Въведете брой дни болнични: ");
- hospital = int.Parse(Console.ReadLine());
- paymentHospital = hospital * paymentDayHospital;
- }
- Console.Write("Работника вземал ли е аванс: Да/Не: ");
- string answear3 = Console.ReadLine();
- if (answear3.ToLower() == "да")
- {
- Console.Write("Въведете сума за аванс: ");
- advance = int.Parse(Console.ReadLine());
- }
- paymentMotnhAll = workDays * paymentPerDay;
- salary = paymentMotnhAll - paymentLeave - paymentHospital;
- if (salary < 0)
- {
- salary = 0;
- }
- montPayment.Add(salary);
- Console.WriteLine();
- }
- for (int j = 0; j < workerName.Count; j++)
- {
- Console.Write("Работник: {0}; Заплата {1}", workerName[j], montPayment[j]);
- Console.WriteLine();
- }
- int total = montPayment.Sum();
- Console.WriteLine("Заплати за месеца тотал: {0}.", total);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement