主题:[讨论]求教下一步该怎么写.关于一个简单的学生档案系统
要求是输入学号,输出对应的信息
开始时建立一个 c# Windows应用程序,并添加一个新类.名为class.
内容为
using System;
using System.Collections.Generic;
using System.Text;
namespace WindowsApplication1
{
class Student
{
protected int _id;
protected string _name;
protected string _gender;
protected int _classes;
protected int _grade;
public int ID
{
get {return _id;}
set {_id=value;}
}
public string Name
{
get {return _name;}
set {_name=value;}
}
public string Gender
{
get { return _gender; }
set { _gender = value; }
}
public virtual int Classes
{
get { return _classes; }
set { _classes = value; }
}
public virtual int Grade
{
get { return _grade; }
set { _grade = value; }
}
}
class Undergraduate : Student
{
protected string _department;
public string Department
{
get { return _department; }
set { _department = value; }
}
}
class Graduate : Student
{
protected string _tutor;
public string Tutor
{
get { return _tutor; }
set { _tutor = value; }
}
}
}
在form.cs中
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Student[] students = new Student[3];
[color=FFFF00] students[0]._id = 001;
students[0]._name = "张浩";
students[0]._gender = "男";
students[0]._classes = 1;
students[0]._grade = 2;
}
}
}
下面该怎么编写.(在应用程序中的学号中输入 001 显示其他信息)
开始时建立一个 c# Windows应用程序,并添加一个新类.名为class.
内容为
using System;
using System.Collections.Generic;
using System.Text;
namespace WindowsApplication1
{
class Student
{
protected int _id;
protected string _name;
protected string _gender;
protected int _classes;
protected int _grade;
public int ID
{
get {return _id;}
set {_id=value;}
}
public string Name
{
get {return _name;}
set {_name=value;}
}
public string Gender
{
get { return _gender; }
set { _gender = value; }
}
public virtual int Classes
{
get { return _classes; }
set { _classes = value; }
}
public virtual int Grade
{
get { return _grade; }
set { _grade = value; }
}
}
class Undergraduate : Student
{
protected string _department;
public string Department
{
get { return _department; }
set { _department = value; }
}
}
class Graduate : Student
{
protected string _tutor;
public string Tutor
{
get { return _tutor; }
set { _tutor = value; }
}
}
}
在form.cs中
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Student[] students = new Student[3];
[color=FFFF00] students[0]._id = 001;
students[0]._name = "张浩";
students[0]._gender = "男";
students[0]._classes = 1;
students[0]._grade = 2;
}
}
}
下面该怎么编写.(在应用程序中的学号中输入 001 显示其他信息)