个人作业——计应191西第七组杨得胜
代码如下:
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Text;
using
System.Windows.Forms;
namespace
计算器
{
public
partial
class
Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
public
string
num;
public
int
flag;
public
double
num1, num2;
private
void
num0_button_Click(
object
sender, EventArgs e)
{
num = num +
"0"
;
num2 = Convert.ToDouble(num);
textBox.Text = num;
}
private
void
num1_button_Click(
object
sender, EventArgs e)
{
if
(textBox.Text ==
"0"
)
{
num =
"1"
;
textBox.Text = Convert.ToString(num);
}
else
{
num = num +
"1"
;
num2 = Convert.ToDouble(num);
textBox.Text = num;
}
}
private
void
num2_button_Click(
object
sender, EventArgs e)
{
if
(textBox.Text ==
"0"
)
{
num =
"2"
;
textBox.Text = Convert.ToString(num);
}
else
{
num = num +
"2"
;
num2 = Convert.ToDouble(num);
textBox.Text = num;
}
}
private
void
num3_button_Click(
object
sender, EventArgs e)
{
if
(textBox.Text ==
"0"
)
{
num =
"3"
;
textBox.Text = Convert.ToString(num);
}
else
{
num = num +
"3"
;
num2 = Convert.ToDouble(num);
textBox.Text = num;
}
}
private
void
num4_button_Click(
object
sender, EventArgs e)
{
if
(textBox.Text ==
"0"
)
{
num =
"4"
;
textBox.Text = Convert.ToString(num);
}
else
{
num = num +
"4"
;
num2 = Convert.ToDouble(num);
textBox.Text = num;
}
}
private
void
num5_button_Click(
object
sender, EventArgs e)
{
if
(textBox.Text ==
"0"
)
{
num =
"5"
;
textBox.Text = Convert.ToString(num);
}
else
{
num = num +
"5"
;
num2 = Convert.ToDouble(num);
textBox.Text = num;
}
}
private
void
num6_button_Click(
object
sender, EventArgs e)
{
if
(textBox.Text ==
"0"
)
{
num =
"6"
;
textBox.Text = Convert.ToString(num);
}
else
{
num = num +
"6"
;
num2 = Convert.ToDouble(num);
textBox.Text = num;
}
}
private
void
num7_button_Click(
object
sender, EventArgs e)
{
if
(textBox.Text ==
"0"
)
{
num =
"7"
;
textBox.Text = Convert.ToString(num);
}
else
{
num = num +
"7"
;
num2 = Convert.ToDouble(num);
textBox.Text = num;
}
}
private
void
num8_button_Click(
object
sender, EventArgs e)
{
if
(textBox.Text ==
"0"
)
{
num =
"8"
;
textBox.Text = Convert.ToString(num);
}
else
{
num = num +
"8"
;
num2 = Convert.ToDouble(num);
textBox.Text = num;
}
}
private
void
num9_button_Click(
object
sender, EventArgs e)
{
if
(textBox.Text ==
"0"
)
{
num =
"9"
;
textBox.Text = Convert.ToString(num);
}
else
{
num = num +
"9"
;
num2 = Convert.ToDouble(num);
textBox.Text = num;
}
}
private
void
add_button_Click(
object
sender, EventArgs e)
{
if
(textBox.Text.Length > 0)
{
num1 = Convert.ToDouble(textBox .Text);
num =
""
;
flag = 1;
textBox.Text =
""
;
textBox.Focus();
}
}
private
void
dev_button_Click(
object
sender, EventArgs e)
{
if
(textBox.Text.Length > 0)
{
num1 = Convert.ToDouble(textBox.Text);
num =
""
;
flag = 2;
textBox.Text =
""
;
textBox.Focus();
}
}
private
void
mul_button_Click(
object
sender, EventArgs e)
{
if
(textBox.Text.Length > 0)
{
num1 = Convert.ToDouble(textBox.Text);
num =
""
;
flag = 3;
textBox.Text =
""
;
textBox.Focus();
}
}
private
void
chu_button_Click(
object
sender, EventArgs e)
{
if
(textBox.Text.Length > 0)
{
num1 = Convert.ToDouble(textBox.Text);
num =
""
;
flag = 4;
// textBox.Text = "";
textBox.Focus();
}
}
private
void
equ_button_Click(
object
sender, EventArgs e)
{
switch
(flag)
{
case
1:
textBox.Text = Convert.ToString(num1+Convert .ToDouble(num));
num2 = Convert.ToDouble(textBox .Text);
break
;
case
2:
textBox.Text = Convert.ToString(num1 - Convert.ToDouble(num));
num2 = Convert.ToDouble(textBox.Text);
break
;
case
3:
textBox.Text = Convert.ToString(num1 * Convert.ToDouble(num));
num2 = Convert.ToDouble(textBox.Text);
break
;
case
4:
textBox.Text = Convert.ToString(num1 / Convert.ToDouble(num));
num2 = Convert.ToDouble(textBox.Text);
break
;
}
}
private
void
re_button_Click(
object
sender, EventArgs e)
{
num =
""
;
textBox.Text =
"0"
;
}
}
}
PSP阶段 |
预计所需时间(h) |
实际所需时间(h) |
计划 |
0.5 | 0.5 |
开发 | 1 | 1 |
需求分析 (包括学习新技术) | 0.5 | 0.5 |
· 生成设计文档 | 2 | 2 |
· 设计复审 (和同事审核设计文档) | 2 | 2 |
代码规范 (为目前的开发制定合适的规范) | 1 | 2 |
具体设计 | 1 | 0.5 |
具体编码 | 2 | 1 |
· 代码复审 | 5 | 2 |
· 测试(自我测试,修改代码,提交修改) | 4 | 3 |
报告 |
4 | 1 |
· 测试报告 | 1 | 1 |
计算工作量 | 2 | 2 |
· 事后总结 ,并提出过程改进计划 | 1 | 0.5 |
增加团队的自我管理能力。