一、计划
这个程序需要3天。
二、开发
1、需求分析
用户故事:作为一个观众,我希望了解某一场比赛的比分,以便了解赛况。(满意条件:精确到每一局的结果比分)。
从分析用例故事可以知道完成此程序需要这两项任务:选择队伍和查询比赛记录
2、程序活动图
3、具体编码与设计
代码:
namespace 排球计分器
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int m = 1;
private void button1_Click(object sender, EventArgs e)
{
int a1 = int.Parse(txta1.Text);
int a2 = int.Parse(txta2.Text);
int b1 = int.Parse(txtb1.Text);
int b2 = int.Parse(txtb2.Text);
int c1 = int.Parse(txtc1.Text);
int c2 = int.Parse(txtc2.Text);
if (a1 < 9)
{
txta1.Text = 0 + (a1 + 1).ToString();
}
else
{
if (m == 5)
{
if (a1 >= 14 && a1 <= a2 || a1 < 14)
{
txta1.Text = (a1 + 1).ToString();
}
else
{
txtb1.Text = (b1 + 1).ToString();
txtc1.Text = (c1 + 1).ToString();
txtjieju.Text += "第" + m + "局" + (a1 + 1).ToString() + ":" + txta2.Text + "
" + "
";
txtc2.Text = "0";
}
}
else
{
if (a1 >= 24 && a1 <= a2 || a1 < 24)
{
txta1.Text = (a1 + 1).ToString();
}
else
{
txtb1.Text = (b1 + 1).ToString();
txtc1.Text = (c1 + 1).ToString();
txtjieju.Text += "第" + m + "局" + (a1 + 1).ToString() + ":" + txta2.Text + "
" + "
";
txta1.Text = "00";
txta2.Text = "00";
txtc2.Text = "0";
txtm.Text = "第 " + (m + 1) + " 场";
m = m + 1;
}
}
}
if (txtb1.Text == "3")
{
txta1.Text = "00";
txta2.Text = "00";
txtb1.Text = "0";
txtb2.Text = "0";
txtc1.Text = "0";
txtc2.Text = "0";
m = 0;
txtm.Text = "第 " + (m + 1) + " 场";
txtjieju.Text += "第" + m + "局" + (a1 + 1).ToString() + ":" + txta2.Text + "
" + "
" + txtd1.Text + "胜";
}
}
private void txta1_TextChanged(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
int j1 = int.Parse(txta1.Text);
int j2 = int.Parse(txta2.Text);
int m1 = int.Parse(txtb1.Text);
int m2 = int.Parse(txtb2.Text);
int q1 = int.Parse(txtc1.Text);
int q2 = int.Parse(txtc2.Text);
if (j2 < 9)
{
txta2.Text = 0 + (j2 + 1).ToString();
}
else
{
if (m == 5)
{
if (j2 >= 14 && j2 <= j1 || j2 < 14)
{
txta2.Text = (j2 + 1).ToString();
}
else
{
txtb2.Text = (m2 + 1).ToString();
txtc2.Text = (q2 + 1).ToString();
txtjieju.Text += "第" + m + "局" + txta1.Text + ":" + (j2 + 1).ToString() + "
" + "
";
txta1.Text = "00";
txta2.Text = "00";
txtc1.Text = "0";
}
}
if (j2 >= 24 && j2 <= j1||j2<24)
{
txta2.Text = (j2 + 1).ToString();
}
else
{
txtb2.Text = (m2 + 1).ToString();
txtc2.Text = (q2 + 1).ToString();
txtjieju.Text += "第" + m + "局" + txta1.Text + ":" + (j2 + 1).ToString() + "
" + "
";
txta1.Text = "00";
txta2.Text = "00";
txtc1.Text = "0";
txtm.Text = "第 " + (m + 1) + " 场";
m = m + 1;
}
}
if (txtb2.Text == "3")
{
txta1.Text = "00";
txta2.Text = "00";
txtb1.Text = "0";
txtb2.Text = "0";
txtc1.Text = "0";
txtc2.Text = "0";
m = 0;
txtm.Text = "第 " + (m + 1) + " 场";
txtjieju.Text += "第" + m + "局" + txta1.Text + ":" + (j2 + 1).ToString() + "
" + "
" + txtd2.Text + "胜";
}
}
private void label1_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
}
}
4、程序截图
五、报告
测试报告:测试通过(测试截图还没有写上去)
计算工作量:三天零四个小时(超出预计时间)
事后总结:通过这个程序的完成,发现有很多不足的地方,首先时间没有按预定的三天完成,程序还有多处不完善,对于这些问题我会进一步改善,争取下次做的更好!