ACCP7.0s2深入.net和c#第七章上机123
2017-03-05 16:43
453 查看
--上机1
public class instrument
{
public virtual string play() {
return "";
}
}
--上机2 3
public class codejob:Job
{
public codejob(string type,string name,string desc):base(type,name,desc) { }
public codejob() { }
public int codinglines { get; set; }
public int bugs { get; set; }
public int workday { get; set; }
public override void Execute()
{
Form2 f = new Form2();
f.ShowDialog();
}
public override string Show(int a,int b,int c)
{
return "有效编码行数:" + codinglines + "遗留问题:" + bugs + "工作日" + workday;
}
}
public class instrument
{
public virtual string play() {
return "";
}
}
public class piano:instrument { public override string play() { return "钢琴在演奏"; } }
public class sachs:instrument { public override string play() { return "萨克斯在演奏"; } }
public class SE { public string no { get; set; } public string name { get; set; } public string pop { get; set; } public SE() { } public SE(string no,string name,string pop) { this.no = no; this.name = name; this.pop = pop; } }
public class violin:instrument { public override string play() { return "小提琴在演奏"; } }
public partial class Form1 : Form { public Form1() { InitializeComponent(); init(); } public void init() { List<SE> e = new List<SE>(); SE a = new SE("001","王小明","100"); SE b = new SE("002", "周新宇", "200"); SE c = new SE("003", "盖茨", "300"); e.Add(a); e.Add(b); e.Add(c); this.dataGridView1.DataSource = e; } private void 演奏ToolStripMenuItem_Click(object sender, EventArgs e) { Form2 f = new Form2(); DataGridViewRow dr = this.dataGridView1.CurrentRow; string s = dr.Cells[1].Value.ToString(); f.title = s + "开始演奏"; f.ShowDialog(); } }
public partial class Form2 : Form { public Form2() { InitializeComponent(); } public string title { set { this.groupBox1.Text = value; } } private void button1_Click(object sender, EventArgs e) { SE em = new SE(); instrument i = null; if (this.radioButton1.Checked) { i = new piano(); } else if (this.radioButton2.Checked) { i = new violin(); } else if (this.radioButton3.Checked) { i = new sachs(); } MessageBox.Show(i.play()); } }
--上机2 3
public class codejob:Job
{
public codejob(string type,string name,string desc):base(type,name,desc) { }
public codejob() { }
public int codinglines { get; set; }
public int bugs { get; set; }
public int workday { get; set; }
public override void Execute()
{
Form2 f = new Form2();
f.ShowDialog();
}
public override string Show(int a,int b,int c)
{
return "有效编码行数:" + codinglines + "遗留问题:" + bugs + "工作日" + workday;
}
}
public abstract class Job { public string type { get; set; } public string name { get; set; } public string description { get; set; } public Job(string type, string name, string description) { this.type = type; this.name = name; this.description = description; } public Job() { } public abstract void Execute(); public abstract string Show(int a,int b,int c); }
public class testjob:Job { public testjob(string type,string name,string desc):base(type,name,desc) {} public testjob() { } public int casenum { get; set; } public int findbugs { get; set; } public int workday { get; set; } public override void Execute() { Form3 f = new Form3(); f.ShowDialog(); } public override string Show(int a,int b,int c) { return "测试用例个数:" + a + "发现bug数量:" + b + "所需工作日:" + c; } }
public partial class Form1 : Form { public Form1() { InitializeComponent(); init(); } public void init() { List<Job> j = new List<Job>(); j.Add(new codejob("编码","编码","实现购物车模块")); j.Add(new codejob("编码", "编码基类", "完成项目基类模块")); j.Add(new testjob("测试", "压力测试", "测试项目已实现模块")); this.dataGridView1.DataSource = j; } codejob c = new codejob(); testjob t = new testjob(); private void dataGridView1_CellC 4000 ontentClick(object sender, DataGridViewCellEventArgs e) { } private void 执行ToolStripMenuItem_Click(object sender, EventArgs e) { int index = this.dataGridView1.CurrentRow.Index; if (index < 2) { c.Execute(); } else { t.Execute(); } } private void 完成情况ToolStripMenuItem_Click(object sender, EventArgs e) { int index = this.dataGridView1.CurrentRow.Index; if (index < 2) { MessageBox.Show(c.Show(c.codinglines, c.bugs, c.workday)); } else { MessageBox.Show(t.Show(t.casenum,t.findbugs,t.workday)); } } }
public partial class Form2 : Form { codejob j = new codejob(); public Form2() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { j.codinglines = Int32.Parse(this.textBox1.Text.ToString()); j.bugs = Int32.Parse(this.textBox2.Text.ToString()); j.workday = Int32.Parse(this.textBox3.Text.ToString()); MessageBox.Show("提交成功!"); this.Close(); } }
public partial class Form3 : Form { testjob t = new testjob(); public Form3() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { t.casenum = Int32.Parse(this.textBox1.Text.ToString()); t.findbugs = Int32.Parse(this.textBox1.Text.ToString()); t.workday = Int32.Parse(this.textBox1.Text.ToString()); MessageBox.Show("提交成功"); this.Close(); } }
相关文章推荐
- accp7.0S2深入.net和c#第三章上机123
- accp7.0S2深入.NET和C#第二章上机3
- ACCP7.0S2深入.NET和C#编程第二章上机1,2
- ACCP7.0S2深入.net和c#第6章上机练习
- ACCP7.0S2深入.net和c#第九章小型资源管理器
- 深入.NET平台和C#编程第二张上机练习2
- 深入.NET平台和C#编程 第二章 上机3 经理评分
- 深入.NET 第七章上机2上机3 员工工作
- 深入.NET和C#第二章上机3
- 深入.NET 第七章上机4 给宠物看病
- 深入.NET 第七章 上机1 演奏
- 深入.NET平台和C#编程 第一章 概念+上机
- 深入.NET平台和C#编程 第三章 学习笔记
- S2 深入.NET平台和C#语言 第三章 课上练习
- 深入.NET 第二章 上机练习2
- ACCP7.0S2优化MySchool数据库设计第三章上机1-3
- ACCP7.0S2优化myschool数据库设计第二章上机练习1-7
- ACCP S1 C#第十四章 第十五章 上机练习
- ACCP学习旅程之-----使用C#开发数据库应用程序(第七章 用ADO.NET查询和操作数据库)
- 深入.NET平台和C#编程基础小结