first try
This commit is contained in:
64
Program.cs
64
Program.cs
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using su.divan2000.SalaryApp.Models;
|
||||
using su.divan2000.SalaryApp.Services;
|
||||
using su.divan2000.SalaryApp.Utils;
|
||||
|
||||
namespace su.divan2000.SalaryApp
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static SalaryHistory history = new SalaryHistory();
|
||||
|
||||
static void Main()
|
||||
{
|
||||
var menu = new Menu("=== Калькулятор зарплаты охранника ===");
|
||||
|
||||
menu.AddOption("Новый расчёт", NewCalculation);
|
||||
menu.AddOption("История расчётов", ShowHistory);
|
||||
menu.AddOption("Сравнить расчёты", CompareCalculations);
|
||||
menu.AddOption("Статистика", ShowStatistics);
|
||||
menu.AddOption("Выход", () => Environment.Exit(0));
|
||||
|
||||
while (true)
|
||||
{
|
||||
menu.RunMenu();
|
||||
}
|
||||
}
|
||||
|
||||
static void NewCalculation()
|
||||
{
|
||||
SalaryData data = InputHelper.CreateSalaryData();
|
||||
|
||||
data.CalculateSalary();
|
||||
history.Add(data);
|
||||
|
||||
OutputHelper.PrintSalaryData(data);
|
||||
OutputHelper.WaitForKey();
|
||||
}
|
||||
|
||||
static void ShowHistory()
|
||||
{
|
||||
history.ShowHistory();
|
||||
OutputHelper.WaitForKey();
|
||||
}
|
||||
|
||||
static void CompareCalculations()
|
||||
{
|
||||
history.ShowHistory();
|
||||
|
||||
Console.Write('\n');
|
||||
|
||||
int first = InputHelper.AskInt("Введите номер первого расчёта: ");
|
||||
int second = InputHelper.AskInt("Введите номер второго расчёта: ");
|
||||
|
||||
history.Compare(first, second);
|
||||
OutputHelper.WaitForKey();
|
||||
}
|
||||
|
||||
static void ShowStatistics()
|
||||
{
|
||||
history.ShowStatistics();
|
||||
OutputHelper.WaitForKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user