ACCP7.0s2深入.net和c#第七章上机123
来源:互联网 发布:java设计 编辑:程序博客网 时间:2024/06/10 22:05
--上机1
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_CellContentClick(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(); } }
0 0
- ACCP7.0s2深入.net和c#第七章上机123
- accp7.0S2深入.net和c#第三章上机123
- ACCP7.0S2深入.NET和C#编程第二章上机1,2
- accp7.0S2深入.NET和C#第二章上机3
- ACCP7.0S2深入.net和c#第6章上机练习
- ACCP7.0S2深入.net和c#第九章小型资源管理器
- S2 深入.NET 第二章 上机题
- ACCP7.0S2优化myschool数据库设计第二章上机练习1-7
- ACCP7.0S2优化MySchool数据库设计第三章上机1-3
- ACCP7.0S2优化myschool数据库设计第四章上机1-4
- 深入.NET 第七章 上机1 演奏
- accp7.0S2优化myschool数据库设计第五章项目
- 深入.NET 第七章上机2上机3 员工工作
- S2 深入.NET平台和C#语言 第三章 课上练习
- 深入.NET和C#第二章上机3
- accp7.0-S2 优化MySchool数据库设计
- accp7.0-s2 优化MySchool数据库
- Accp7.0 第14章 上机练习1 实现客户姓名的添加和显示
- linux ls find rename grep
- Linux命令——文件权限管理
- 自动挂载 Automount
- LeetCode 241. Different Ways to Add Parentheses
- Fastlane的gym指令
- ACCP7.0s2深入.net和c#第七章上机123
- 小型资源管理器
- Android开源弹幕引擎DanmakuFlameMaster源码解析
- 删除字符串中指定的一些字符
- vs2015集成Qt下解决中文乱码
- 写一个通用缓存框架,同时支持ehcache,mecache及spring缓存注解等
- numpy基础学习
- 我的寂寞谁能懂之 -- 资源管理器
- C-C++语言结构体中定义另一个结构体指针的经验