static void Main(string[] args) { Console.WriteLine("Automatic bonus calculation for company employees: ".ToUpper()); Console.WriteLine(new string('-', 50)); Accauntant accauntant = new Accauntant(); // Создание экземпляра класса для расчета премий для сотрудников компании accauntant.Sorting(); Console.ReadKey(); }
static void Main(string[] args) { Post worker = Post.Manager; int hours = 100; Accauntant accauntant = new Accauntant(); if (accauntant.AskForBonus(worker, hours)) { Console.WriteLine("Положена премия."); } else { Console.WriteLine("Старайся больше."); } }
public void Sorting() // Метод для сортировки и вывода в консоли всех сотрудников компании по должностям и их рабочего времени { for (Accauntant.Post employee = Accauntant.Post.Trainee; employee <= Accauntant.Post.SeniorEmployee; employee++) { switch (employee) { case Accauntant.Post.Trainee: { Accauntant accauntantOne = new Accauntant(); Console.WriteLine(employee + ": (normal - 50 hours)\n"); accauntantOne.AskForBonus(employee, 50); break; } case Accauntant.Post.JuniorEmployee: { Accauntant accauntantTwo = new Accauntant(); Console.WriteLine(employee + ": (normal - 80 hours)\n"); accauntantTwo.AskForBonus(employee, 80); break; } case Accauntant.Post.MiddleEmployee: { Accauntant accauntantThree = new Accauntant(); Console.WriteLine(employee + ": (normal - 120 hours)\n"); accauntantThree.AskForBonus(employee, 120); break; } case Accauntant.Post.SeniorEmployee: { Accauntant accauntantFive = new Accauntant(); Console.WriteLine(employee + ": (normal - 120 hours)\n"); accauntantFive.AskForBonus(employee, 120); break; } } } }
static void Main(string[] args) { Accauntant accauntant = new Accauntant(); //Console.WriteLine("Choose position (Manager/ Grunt/ VicePresident):"); //string choice = Console.ReadLine(); //Console.WriteLine("Type hours:"); //int hours = Int32.Parse(Console.ReadLine()); Post manager = Post.Manager; Post grunt = Post.Grunt; Post vicePresident = Post.VicePresident; Console.WriteLine("The {0} worked for 36 hours and asking for bonus:\nAccauntant says: {1}\n", manager, // эти три блока лучше вынести в другой класс. accauntant.AskForBonus(manager, 36) ? "OK" : "No, wokr harder!"); Console.WriteLine("The {0} worked for 45 hours and asking for bonus:\nAccauntant says: {1}\n", grunt, accauntant.AskForBonus(grunt, 45) ? "You must be kidding..." : "No way! Go and work!!!"); Console.WriteLine("The {0} worked for 10 hours and asking for bonus:\nAccauntant says: {1}\n", vicePresident, accauntant.AskForBonus(vicePresident, 10) ? "OK, Sir!" : "OK, Sir!"); }