public abstract class Employee
{
public string name { get; set; }
public decimal earnings { get; set; } //实发工资
public DateTime bornDay { get; set; } //出生日期
public abstract string Type { get; } //职工职务
public Employee() { }
public Employee(string nm, int year, int month, int day)
{
name = nm;
bornDay = new DateTime(year, month, day);
}
public abstract void Earnings();
public virtual void Display()
{
//System.Globalization.CultureInfo zh_cul;
//zh_cul = System.Globalization.CultureInfo.GetCultureInfo("zh");
Console.WriteLine("职工名字:{0},出生日期:{1},职务:{2},工资:{3}", name, bornDay.ToString("yyyy//MM/dd"), Type, earnings.ToString("C2"));
}
}
public class Manager : Employee
{
public double salary; //基本工资
public double bonus; //资金
public Manager() { }
public Manager(string nm, int year, int month, int day, double sl, double bns) : base(nm, year, month, day)
{
salary = sl;
bonus = bns;
}
public override void Earnings()
{
earnings = (decimal)(salary + bonus);
}
public override string Type
{
get { return Type; }
}
public override void Display()
{
base.Display();
Console.WriteLine("基本工资:{0},资金:{1}.", salary.ToString("C2"), bonus.ToString("C2"));
}
}