首页 新闻 会员 周边 捐助

帮帮忙~~~.NET问题!!!

0
[已关闭问题] 关闭于 2010-04-19 18:29

老师让我们做个窗体,但是写的一直有问题!希望大家帮帮我!

代码还没有写完,希望大家帮忙弄弄!

 

 

基类:
person:
字段:身份证号码(10位),姓名,性别,年龄(1-130),身高,体重,籍贯(省市县)。
属性
方法:构造函数,set_name(不是虚方法),string ToString()(输出方法,为虚方法)

派生类:
student:
新增字段:学号,班级,专业,选修课程(字符串数组),所在系。
属性:
方法:构造函数,set_name,ToString()(输出方法)

派生类

Title在这里输入文本...

teacher:
新增字段:工资,专业,任教课程(字符串),所在系。

Title在这里输入文本...

属性:
方法:构造函数,set_name,ToString()(输出方法)
.NEt牛人帮帮我!!!谢谢啦~~~

 

 

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace exe107
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == 0)
            {
                textBox1.Visible = false;
                textBox3.Visible = false;
                textBox4.Visible = false;
                textBox5.Visible = false;
                textBox6.Visible = false;
                textBox16.Visible = false;
            }
            else
                if (comboBox1.SelectedIndex == 1)
                {
                    textBox7.Visible = false;
                    textBox8.Visible = false;
                    textBox9.Visible = false;
                    textBox10.Visible = false;
                    textBox11.Visible = false;
                }
                else
                {
                    textBox12.Visible = false;
                    textBox13.Visible = false;
                    textBox14.Visible = false;
                    textBox15.Visible = false;

                }

 


        }

        //private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        //{

        //}
    }
    public class Person
    {
        private int shenfenzheng;

        public int Shenfenzheng
        {
            get { return shenfenzheng; }
            set
            {
                if (value.length == 1000)

                    shenfenzheng = value;

                else MessageBox.Show("请输入10位数的身份证号码");
            }

        }
        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 double high;

        public double High
        {
            get { return high; }
            set { high = value; }
        }
        private double weight;

        public double Weight
        {
            get { return weight; }
            set { weight = value; }
        }
        private String address;

        public String Address
        {
            get { return address; }
            set { address = value; }
        }


        public Person(int sf, String n, String s, int a, double h, double w, String ad)
        {
            shenfenzheng = sf;
            name = n;
            sex = s;
            age = a;
            high = h;
            weight = w;
            address = ad;
        }
        public String shuchu()
        {
            String s = "姓名" + name.ToString + "性别" + sex.ToString + "身份证" + shenfenzheng.ToString + "年龄" + age.ToString + "体重" + weight.ToString;
            ruturn s;
        }
        public void set_name(int n)
        {
            name = n;
        }

    }
    public class Student : Person
    {
        private int StudentID;

        public int StudentID1
        {
            get { return StudentID; }
            set { StudentID = value; }
        }
        private String banji;

        public String Banji
        {
            get { return banji; }
            set { banji = value; }
        }
        private String zhuanye;

        public String Zhuanye
        {
            get { return zhuanye; }
            set { zhuanye = value; }
        }
        private String[] xuanke;

        public String[] Xuanke
        {
            get { return xuanke; }
            set { xuanke = value; }
        }
        private String xi;

        public String Xi
        {
            get { return xi; }
            set { xi = value; }
        }
        public Student(int sd, String bj, String zhy,String xk, String x)
        {
            StudentID = sd;
            banji = bj;
            zhuanye = zhy;
            xuanke = xk;
            xi = x;

        }
        public String shuchu()
        {
            String b = "学号" + StudentID.ToString + "班级" + banji.ToString + "专业" + zhuanye.ToString +"选课"+xuanke.ToString + "系" + xi.ToString;
        }
        public void set_name(int n)
        {
            name = n;
        }

    }
    public class Teacher : Person
    {
        private float gongzi;

        public float Gongzi
        {
            get { return gongzi; }
            set { gongzi = value; }
        }
        private String zhuanye;

        public String Zhuanye
        {
            get { return zhuanye; }
            set { zhuanye = value; }
        }
        private String jiaoke;

        public String Jiaoke
        {
            get { return jiaoke; }
            set { jiaoke = value; }
        }
        private String xi;

        public String Xi
        {
            get { return xi; }
            set { xi = value; }
        }
        public Teacher(float gz, String zhy, String jk, String x)
        {
            gongzi = gz;
            zhuanye = zhy;
            jiaoke = jk;
            xi = x;
        }
        public String shuchu()
        {
            String b = "工资" + gongzi.ToString + "专业" + zhuanye.ToString +"班级" +jiaoke.ToString  + "系" + xi.ToString;
        }
        public void set_name(int n)
        {
            name = n;
        }

    }

 

 

}

 

dwzone的主页 dwzone | 初学一级 | 园豆:200
提问于:2010-04-10 10:12
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册