-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
54 lines (46 loc) · 2.25 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
using System.Globalization;
using System.Security.Authentication;
using verificationSalary;
using verificationSalary.Entities;
using verificationSalary.Entities.Enums;
namespace ProjectSalary {
class Program{
static void Main(string[] args) {
Console.Write("Enter department's name: ");
string deptName = Console.ReadLine();
Console.WriteLine("Enter worker data: ");
Console.Write("Name: ");
string name = Console.ReadLine();
Console.Write("Level (Junior/MidLevel/Senior): ");
WorkerLevel level = Enum.Parse<WorkerLevel>(Console.ReadLine());
Console.Write("Base salary: ");
double baseSalary = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
Department dept = new Department(deptName);
Worker worker = new Worker(name, level, baseSalary, dept);
Console.Write("How many contracts to this worker? ");
int n = int.Parse(Console.ReadLine());
for (int i = 1; i <= n; i++)
{
Console.WriteLine("Enter #" + i + " contract data:");
Console.WriteLine("Date (DD/MM/YYYY): ");
DateTime date = DateTime.Parse(Console.ReadLine());
Console.Write("Value per hour: ");
double valuePerHour = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture);
Console.WriteLine("Durations (hours): ");
int hours = int.Parse(Console.ReadLine());
HourContract contract = new HourContract(date, valuePerHour, hours);
worker.AddContract(contract);
}
Console.WriteLine();
Console.Write("Enter month and year to calculate income (MM/YYYY): ");
string monthAndYear = Console.ReadLine();
int month = int.Parse(monthAndYear.Substring(0, 2));
int year = int.Parse(monthAndYear.Substring(3));
Console.WriteLine();
Console.WriteLine("Name: " + worker.Name);
Console.WriteLine("Department: " + worker.Department.Name);
Console.WriteLine("Income for: " + monthAndYear + ": " + worker.Income(year, month));
}
}
}