-
Notifications
You must be signed in to change notification settings - Fork 0
/
Employee.cs
71 lines (66 loc) · 1.6 KB
/
Employee.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Employee;
class Employee {
private int id;
private string firstName;
private string lastName;
private int salary;
public Employee(int id, String firstName, String lastName, int salary)
{
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.salary = salary;
}
public int getId()
{
return id;
}
public string getFirstName()
{
return firstName;
}
public string getLastName()
{
return lastName;
}
public string getName()
{
return firstName + " " + lastName;
}
public int getSalary()
{
return salary;
}
public void setSalary(int salary)
{
}
public int getAnnualSalary()
{
return salary * 12;
}
public int raiseSalary(int percent)
{
int newSalary;
newSalary = salary * (percent / 100);
salary += newSalary;
return salary;
}
public String toString()
{
return($"Zamestanec[id = {id}, jmeno = {firstName} {lastName}, vyplata= {salary}]");
}
}
class TestEmployee {
public static void Mainx()
{
Employee e1 = new Employee(1,"Mark","Buffalo",35000);
Console.WriteLine(e1.toString());
Console.WriteLine($"Vyplata procenta {e1.raiseSalary(15)}");
Console.WriteLine($"Rocni mzda je {e1.getAnnualSalary()}");
}
}