标题:萌新上路,求助一道类库的问题,尽量详细一些
只看楼主
a154734817
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2020-11-16
结帖率:100%
已结贴  问题点数:20 回复次数:2 
萌新上路,求助一道类库的问题,尽量详细一些
搜索更多相关主题的帖子: 类库 
2020-11-16 12:04
haitao0000
Rank: 2
等 级:论坛游民
帖 子:9
专家分:60
注 册:2020-11-4
得分:20 
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"));
        }
    }
2020-11-18 11:47
a154734817
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2020-11-16
得分:0 
已采纳
2020-11-22 18:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-503908-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.092083 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved