0% found this document useful (0 votes)
17 views2 pages

Kiemtra

The document contains code for a program that defines methods to input, output, and calculate salary for employee objects. It includes methods to: 1) Input employee ID, name, age, date of birth, and base salary 2) Output employee details and calculated salary 3) Calculate salary by multiplying base salary by 840000 4) Input a list of employees by number and call the input method 5) Output the list of employees 6) Add new employees to the list by calling the input method

Uploaded by

Vũ Huỳnh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

Kiemtra

The document contains code for a program that defines methods to input, output, and calculate salary for employee objects. It includes methods to: 1) Input employee ID, name, age, date of birth, and base salary 2) Output employee details and calculated salary 3) Calculate salary by multiplying base salary by 840000 4) Input a list of employees by number and call the input method 5) Output the list of employees 6) Add new employees to the list by calling the input method

Uploaded by

Vũ Huỳnh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

public void NHAP()

{
Console.Write("moi ban nhap ma so ");
maso = long.Parse(Console.ReadLine());
Console.Write("moi ban nhap ten");
ten = Console.ReadLine();
Console.Write("moi ban nhap tuoi");
tuoi = int.Parse(Console.ReadLine());
Console.Write("moi ban nhap ngay sinh");
ngaysinh = Console.ReadLine();
Console.Write("moi ban nhap luong co ban");
luongcb = double.Parse(Console.ReadLine());
}
-----------------------------------------------------------------------------------public void XUAT()
{
Console.WriteLine("ma so cua nhan vien la {0} ",maso);
Console.WriteLine("ma so cua nhan vien la {0} ", ten);
Console.WriteLine("ma so cua nhan vien la {0} ", tuoi);
Console.WriteLine("ma so cua nhan vien la {0} ", ngaysinh);
Console.WriteLine("ma so cua nhan vien la {0} ", luongcb*840000);
Console.WriteLine("---------------------------------------------------------------------------");
}
public double luong()
{
return luongcb * 840000;
}

Hm to nhp danh sch


public void nhapdanhsach()
{
Console.WriteLine("moi ban nhap so nhan vien");
int n=int.Parse(Console.ReadLine());
for (int i = 0; i < n; i++)
{
nhanvien a = new nhanvien();
a.NHAP();
danhnhanvien.Add(a);
}
}
Xut danh sch--------------------------------------------------------------------------public void xuatdanhsach()
{
foreach(nhanvien item in danhnhanvien)
{
item.XUAT();
}
}
Them-----------------------------------------------------------static int index = -1;//cn phi khai bo th bin idex mi ko li
public void them()
{
bool next = true;
while (next)

{
Console.WriteLine("nhap thong tin nhan vien");
nhanvien n = new nhanvien();
n.NHAP();
danhnhanvien[++ index] = n;
Console.WriteLine("ban co muon nhap nua hay ko (co/ko)");
string luachon = Console.ReadLine();
if (luachon.ToUpper() == "co")
{ next = true; }
else next = false;
}

You might also like