| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 563 人关注过本帖
标题:【高分】拜求一个c#程序(高人请进)
只看楼主 加入收藏
ss637315
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-6-12
结帖率:0
收藏
已结贴  问题点数:5 回复次数:2 
【高分】拜求一个c#程序(高人请进)
定义Teacher(教师)类和Cadre(干部)接口,再定义Teacher_Cadre(教师兼干部)类以继承Teacher类和实现Cadre接口。
要求:1.在Teacher类中包括变量成员Name(姓名),Sex(性别),Age(年龄),Tttle(职称),Add(地址),Tel(电话)和方法成员Display用以输出教师的姓名,性别,电话。2.在Cadre接口中包括属性成员Post(职务)3.用Teacher_Cadre类的方法成员Show调用Teacher类中的Display方法,输出教师的姓名,性别,年龄,职务,地址,电话。4.用来测试类和接口功能的方法Main必须放在Teacher_Cadre类中。
搜索更多相关主题的帖子: 高分 高人 
2010-06-12 13:22
chenkb730
Rank: 2
等 级:论坛游民
帖 子:39
专家分:44
注 册:2010-3-22
收藏
得分:2 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 面向对象练习
{
    public interface Cadre
    {
        string Post
        {
            
            get;
        }
    }
    public class Teacher
    {
        string name;
        string sex;
        int age;
        string title;
        string address;
        int tel;
        public Teacher() { }
        public Teacher(string name, string sex, int age, string title, string address, int tel)
        {
            this.name = name;
            this.sex = sex;
            this.age = age;
            this.title = title;
            this.address = address;
            this.tel = tel;
        }
        public void Display()
        {
            Console.WriteLine( "姓名:{0},性别:{1}年龄:{2}职称:{3}地址:{4}电话:{5}",name,sex ,age ,title ,address ,tel );
        }
    }
    public class Teacher_Cadre : Teacher, Cadre
    {
        public Teacher_Cadre(string name, string sex, int age, string title, string address, int tel)
            : base(name,sex, age, title, address, tel)
        {
 
        }
        public string Post
        {

            get { return "经理:"; }
        }
        public void Show()
        {
           Console.Write("职务:{0}",Post);
            Display();
        }


        static void Main(string[] args)
        {
            Teacher_Cadre tom = new Teacher_Cadre("tom","男",20,"经理","广东",123456);
            tom.Show();
        }
    }
    }
2010-06-19 11:23
zhenxiaoyan
Rank: 2
等 级:论坛游民
帖 子:22
专家分:40
注 册:2009-8-24
收藏
得分:2 
回复 楼主 ss637315
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 面向对象练习
{
    public interface Cadre
    {
        string Post
        {
            
            get;
        }
    }
    public class Teacher
    {
       private string name;
       public string Name
       {
          get{return name;}
          set{name=value;}
        }
       private string sex;
        public string Sex
       {
          get{return sex;}
          set{sex=value;}
        }

       private int age;
       public int Age
       {
          get{return age;}
          set{age=value;}
        }

       private string title;
       public string Title
      {
          get{return title;}
          set{title=value;}
        }

       private string address;
       public string Address
       {
          get{return address;}
          set{address=value;}
        }

       private int tel;
       public int Tel
       {
          get{return tel;}
          set{tel=value;}
        }

        public Teacher() { }
        public Teacher(string name, string sex, int age, string title, string address, int tel)
        {
            this.Name = name;
            this.Sex = sex;
            this.Age = age;
            this.Title = title;
            this.Address = address;
            this.tel = tel;
        }
        public void Display()
        {
            Console.WriteLine( "姓名:{0},性别:{1}年龄:{2}职称:{3}地址:{4}电话:{5}",name,sex ,age ,title ,address ,tel );
        }
    }
    public class Teacher_Cadre : Teacher, Cadre
    {
        public Teacher_Cadre(string name, string sex, int age, string title, string address, int tel)
            : base(name,sex, age, title, address, tel)
        {

        }
        public string Post
        {

            get { return "经理:"; }
        }
        public void Show()
        {
           Console.Write("职务:{0}",Post);
            Display();
        }


        static void Main(string[] args)
        {
            Teacher_Cadre tom = new Teacher_Cadre("tom","男",20,"经理","广东",123456);
            tom.Show();
        }
    }
    }
2010-06-20 19:33
快速回复:【高分】拜求一个c#程序(高人请进)
数据加载中...
 
   



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

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