life_single2610- New Member
- Giới tính : Bài gửi : 8
Tổng Điểm : 21
Điểm Thưởng : 0
Sinh Nhật : 28/02/1989 Bị Dụ Dỗ : 04/12/2009
Tuổi : 35
by life_single2610 11/12/2009, 20:54
- Code:
using System;
using System.Collections.Generic;
using System.Text;
namespace NHANVIEN
{
public class nguoi
{
private string _hoten, _diachi, _cmnd;
public nguoi()
{
this._hoten = " ";
this._diachi = " ";
this._cmnd = " ";
}
public nguoi(string hoten, string diachi, string cmnd)
{
this.hoten = _hoten;
this.diachi = _diachi;
this.cmnd = _cmnd;
}
public string hoten
{
get
{
return _hoten;
}
set
{
_hoten = value;
}
}
public string diachi
{
get
{
return _diachi;
}
set
{
_diachi = value;
}
}
public string cmnd
{
get
{
return _cmnd;
}
set
{
_cmnd = value;
}
}
public string tostring()
{
return "\nname: " + _hoten + "\ndia chi: " + _diachi + "\nSo CMND: " + _cmnd;
}
}
public class nhanvien : nguoi
{
private string _manv, _bophan;
private long _luong;
public nhanvien()
{
this._manv = " ";
this._bophan= " ";
this._luong = 0;
}
public nhanvien(string manv, string bophan, string luong)
{
this.manv= _manv;
this.bophan=_bophan;
this.luong=_luong;
}
public string manv
{
get
{
return _manv;
}
set
{
_manv = value;
}
}
public string bophan
{
get
{
return _bophan;
}
set
{
_bophan = value;
}
}
public long luong
{
get
{
return _luong;
}
set
{
if (value > 0)
_luong = value;
}
}
public string tostring1()
{
return base.tostring() + "\nma nhan vien :" + manv + "\nMa bo phan:" + bophan + "\nLuong: " + luong;
}
}
public class lanhdao : nhanvien
{
private string _chucvu;
private long _phucap;
public lanhdao()
{
this._chucvu = " ";
this._phucap = 0;
}
public lanhdao(string chucvu, string phucap)
{
this.chucvu= _chucvu;
this.phucap=_phucap;
}
public string chucvu
{
get
{
return _chucvu;
}
set
{
_chucvu = value;
}
}
public long phucap
{
get
{
return _phucap;
}
set
{
if (value > 0)
_phucap = value;
}
}
public string tostring3()
{
return base.tostring1() + "\nchuc vu:" + _chucvu + "\nPhu cap: " + _phucap + "\nTong luong :" + (base.luong + _phucap);
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("nhap vao so nhan vien ");
int n = Convert.ToInt32(Console.ReadLine());
nguoi[] a = new nguoi[n];
Console.WriteLine("___Lop Nguoi_____");
for (int i =0; i <n; i++)
{
Console.WriteLine("\nNhap nhan vien thu {0}",i+1);
a[i] = new nguoi();
Console.WriteLine("\nNhap ho ten:");
a[i].hoten =Console.ReadLine();
Console.WriteLine("nhap dia chi:");
a[i].diachi =Console.ReadLine();
Console.WriteLine("nhap cmnd:");
a[i].cmnd = Console.ReadLine();
}
Console.WriteLine("_______________________________");
for (int i =0; i < n; i++)
{
Console.WriteLine("Thong tin Nv: {0} ", i + 1);
Console.WriteLine("{0}", a[i].tostring());
}
Console.WriteLine("_______________________________");
Console.WriteLine("__Lop Nhan vien__");
nhanvien[] b = new nhanvien[n];
for (int i = 0; i < n; i++)
{
Console.WriteLine("\nNhap nhan vien thu {0}", i+1);
b[i] = new nhanvien();
Console.WriteLine("\nNhap ho ten:");
b[i].hoten =Console.ReadLine();
Console.WriteLine("nhap dia chi:");
b[i].diachi =Console.ReadLine();
Console.WriteLine("nhap cmnd:");
b[i].cmnd = Console.ReadLine();
Console.WriteLine("nhap ma nhan vien:");
b[i].manv = Console.ReadLine();
Console.WriteLine("nhap bo phan:");
b[i].bophan = Console.ReadLine();
Console.WriteLine("nhap luong:");
b[i].luong = long.Parse(Console.ReadLine());
}
Console.WriteLine("_______________________________");
for (int i =0; i <n; i++)
{
Console.WriteLine("Thong Tin Nv :{0} ", i + 1);
Console.WriteLine("{0}", b[i].tostring1());
}
Console.WriteLine("_______________________________");
lanhdao[] c = new lanhdao[n];
Console.WriteLine("__lop Lanh dao_");
for (int i = 0; i < n; i++)
{
Console.WriteLine("\nNhap nhan vien thu {0}", i + 1);
c[i] = new lanhdao();
Console.WriteLine("\nNhap ho ten:");
c[i].hoten =Console.ReadLine();
Console.WriteLine("nhap dia chi:");
c[i].diachi = Console.ReadLine();
Console.WriteLine("nhap cmnd:");
c[i].cmnd =Console.ReadLine();
Console.WriteLine("nhap ma nhan vien:");
c[i].manv =Console.ReadLine();
Console.WriteLine("nhap bo phan:");
c[i].bophan =Console.ReadLine();
Console.WriteLine("\nNhap vao chuc vu:");
c[i].chucvu = Console.ReadLine();
Console.WriteLine("\nNhap vao phu cap:");
c[i].phucap = long.Parse(Console.ReadLine());
Console.WriteLine("nhap luong:");
c[i].luong = long.Parse(Console.ReadLine());
}
Console.WriteLine("_______________________________");
for (int i = 0; i < n; i++)
{
Console.WriteLine("Thong Tin Nv :{0} ", i + 1);
Console.WriteLine("{0}", c[i].tostring3());
}
Console.WriteLine("_______________________________");
Console.ReadLine();
}
}
}