首页 > 代码库 > 本周作业

本周作业

 

计划:

估计这个任务需要多少时间完成:3-4天。

开发:

需求分析:1h

用户故事:作为一个排球教练,我希望知道每场比赛队伍队伍的排名情况,以便给自己的队伍做好部署。

 

设计文档:

1、对队伍进行记分和排名

2、可查询队伍的比分和名次

代码规范:根据Visual Studio 2010规范去写。

 

具体设计:活动

 

设计复审:1h

 

代码规范:(为目前的开发制定合适的规范)

 

技术分享

namespace volleyball

 {public partial class Form1 : Form

 {public Form1()

{InitializeComponent(); }

private void button1_Click(object sender, EventArgs e) 

{

if (txtguojia1.Text == "" || txtguojia1.Text == null)

 {MessageBox.Show("国家名");}

 if (diyiju.Text == "" && txtguojia1.Text != "")

{if (int.Parse(diyichang1.Text) < 25)

{int a = int.Parse(diyichang1.Text);

 a++;

 diyichang1.Text = a.ToString();

 int c = int.Parse(diyichang2.Text);

 if (a == 25 && a - 1 > c)

 {MessageBox.Show("第一局" + button1.Text);

 diyiju.Text = button1.Text;

 int b = int.Parse(changneibifen1.Text);

 b++;

 changneibifen1.Text = b.ToString();}

 }

else

{int a = int.Parse(diyichang1.Text);

 a++;

 diyichang1.Text = a.ToString();

 int c = int.Parse(diyichang2.Text);

 if (a - 1 > c)

{MessageBox.Show("第一局" + button1.Text);

diyiju.Text = button1.Text; 

int b = int.Parse(changneibifen1.Text);

 b++;

 changneibifen1.Text = b.ToString();

 }}} 

else if (dierju.Text == "" && txtguojia1.Text != "")

 {if (int.Parse(dierchang1.Text) < 25)

 {int a=int.Parse(dierchang1.Text);

 a++; 

dierchang1.Text =a.ToString();

int c = int.Parse(dierchang2.Text);

 if (a == 25 && a - 1 > c)

 {MessageBox.Show("第二局" + button1.Text);

 dierju.Text = button1.Text;

 int b = int.Parse(changneibifen1.Text);

 b++;

changneibifen1.Text = b.ToString();

 }}

else

{

 int a = int.Parse(dierchang1.Text);

 a++;

 dierchang1.Text = a.ToString();

 int c = int.Parse(dierchang2.Text);

 if (a - 1 > c)

 {MessageBox.Show("第二局" + button1.Text);

 dierju.Text = button1.Text;

 int b = int.Parse(changneibifen1.Text);

 b++;

 changneibifen1.Text = b.ToString();

 }}}

 else if (disanju.Text == "" && txtguojia1.Text != "")

{int fen = 25; 

if (int.Parse(disanchang1.Text) < fen)

 {int a = int.Parse(disanchang1.Text);

 a++;

 disanchang1.Text = a.ToString();

 int c = int.Parse(disanchang2.Text);

 if (a == fen && a - 1 > c)

 {

 MessageBox.Show("第三局" + button1.Text);

 disanju.Text = button1.Text;

 int b = int.Parse(changneibifen1.Text);

 b++;

 changneibifen1.Text = b.ToString();

 }}

else

 {int a = int.Parse(disanchang1.Text);

 a++;

 disanchang1.Text = a.ToString();

 int c = int.Parse(disanchang2.Text);

 if (a - 1 > c)

 {MessageBox.Show("第三局" + button1.Text);

 disanju.Text = button1.Text;

 int b = int.Parse(changneibifen1.Text);

 b++;

 changneibifen1.Text = b.ToString();

 }}}

 else if (disiju.Text == "" && txtguojia1.Text != "")

 {int fen = 25;

 if (int.Parse(changneibifen1.Text) == 3)

 {MessageBox.Show(button1.Text);

 return;}

 else if (int.Parse(changneibifen2.Text) == 3)

 {MessageBox.Show(button2.Text);

 return;}

 else if (int.Parse(changneibifen1.Text) == 2 || int.Parse(changneibifen2.Text) == 2)

 {fen = 25;}

 if (int.Parse(disichang1.Text) < fen)

 {int a = int.Parse(disichang1.Text);

 a++;

 disichang1.Text = a.ToString();

 int c = int.Parse(disichang2.Text);

 if (a == fen && a - 1 > c)

 {MessageBox.Show("第四局" + button1.Text);

 disiju.Text = button1.Text;

 int b = int.Parse(changneibifen1.Text);

 b++;

 changneibifen1.Text = b.ToString();

 }}

 else

 {int a = int.Parse(disichang1.Text);

 a++;

 disichang1.Text = a.ToString();

 int c = int.Parse(disichang2.Text);

 if (a - 1 > c)

 {MessageBox.Show("第四局" + button1.Text);

 disiju.Text = button1.Text;

 int b = int.Parse(changneibifen1.Text);

 b++;

 changneibifen1.Text = b.ToString();

 }}}

 else if (txtguojia1.Text != "")

 {int fen = 25;

 if (int.Parse(changneibifen1.Text) == 3)

 {MessageBox.Show(button1.Text);

 return;}

 else if (int.Parse(changneibifen2.Text) == 3)

 {MessageBox.Show(button2.Text);

 return;}

 else if (int.Parse(changneibifen1.Text) == 2 || int.Parse(changneibifen2.Text) == 2)

 {fen = 15;}

if (int.Parse(diwuchang1.Text) < fen)

{int a = int.Parse(diwuchang1.Text);

 a++;

 diwuchang1.Text = a.ToString();

 int c = int.Parse(diwuchang2.Text);

 if (a == fen && a - 1 > c)

 {MessageBox.Show("第五局" + button1.Text);

 diwuju.Text = button1.Text;

 int b = int.Parse(changneibifen1.Text);

 b++;

 changneibifen1.Text = b.ToString();

 }}

 else

 {int a = int.Parse(diwuchang1.Text);

 a++;

 diwuchang1.Text = a.ToString();

 int c = int.Parse(diwuchang2.Text);

 if (a - 1 > c)

 {MessageBox.Show("第五局" + button1.Text);

 diwuju.Text = button1.Text;

 int b = int.Parse(changneibifen1.Text);

 b++;

 changneibifen1.Text = b.ToString();

 }}}}

 private void button2_Click(object sender, EventArgs e)

 {if (txtguojia2.Text == "" || txtguojia2.Text == null)

 {MessageBox.Show("输入队伍名称"));}

 if (diyiju.Text == "" && txtguojia2.Text != "")

 {if (int.Parse(diyichang2.Text) < 25)

 {int a = int.Parse(diyichang2.Text);

 a++;

 diyichang2.Text = a.ToString();

 int c = int.Parse(diyichang1.Text);

 if (a == 25 && a-1 > c)

 {MessageBox.Show("第一局" + button2.Text);

 diyiju.Text = button2.Text;

 int b = int.Parse(changneibifen2.Text);

 b++;

 changneibifen2.Text = b.ToString();

}}

 else

 {int a = int.Parse(diyichang2.Text);

 a++;

 diyichang2.Text = a.ToString();

 int c = int.Parse(diyichang1.Text);

 if (a - 1 > c)

 {MessageBox.Show("第一局" + button2.Text);

 diyiju.Text = button2.Text;

 int b = int.Parse(changneibifen2.Text);

 b++;

 changneibifen2.Text = b.ToString();

 }}}

 else if (dierju.Text == "" && txtguojia2.Text != "")

 {if (int.Parse(dierchang2.Text) < 25)

 {int a = int.Parse(dierchang2.Text);

 a++;

 dierchang2.Text = a.ToString();

 int c = int.Parse(dierchang1.Text);

 if (a == 25 && a - 1 > c)

 {MessageBox.Show("第二局?" + button2.Text);

 dierju.Text = button2.Text;

 int b = int.Parse(changneibifen2.Text);

 b++;

 changneibifen2.Text = b.ToString();

 }}

 else

{ int a = int.Parse(dierchang2.Text);

 a++;

 dierchang2.Text = a.ToString();

 int c = int.Parse(dierchang1.Text);

 if (a - 1 > c)

 {MessageBox.Show("第二局" + button2.Text);

 dierju.Text = button2.Text;

 int b = int.Parse(changneibifen2.Text);

 b++; 

changneibifen2.Text = b.ToString();

 }}}

 else if (disanju.Text == "" && txtguojia2.Text != "")

 {int fen = 25;

 if (int.Parse(disanchang2.Text) < fen)

 {int a = int.Parse(disanchang2.Text);

 a++;

 disanchang2.Text = a.ToString();

 int c = int.Parse(disanchang1.Text);

 if (a == fen && a - 1 > c)

 {MessageBox.Show("第三局" + button2.Text);

 disanju.Text = button2.Text;

 int b = int.Parse(changneibifen2.Text);

 b++;

 changneibifen2.Text = b.ToString();

 }}

 else

 {int a = int.Parse(disanchang2.Text);

 a++;

 disanchang2.Text = a.ToString();

 int c = int.Parse(disanchang1.Text);

 if (a - 1 > c)

 {MessageBox.Show("第三局" + button2.Text);

 disanju.Text = button2.Text;

 int b = int.Parse(changneibifen2.Text);

 b++;

 changneibifen2.Text = b.ToString();

 }}}

 else if (disiju.Text == "" && txtguojia2.Text != "")

 {int fen = 25;

 if (int.Parse(changneibifen1.Text) == 3)

 {MessageBox.Show(button1.Text);

 return;}

 else if (int.Parse(changneibifen2.Text) == 3)

 {MessageBox.Show(button2.Text);

 return;}

 else if (int.Parse(changneibifen1.Text) == 2 || int.Parse(changneibifen2.Text) == 2)

 {fen = 25;}

 if (int.Parse(disichang2.Text)

 {int a = int.Parse(disichang2.Text);

 a++;

 disichang2.Text = a.ToString();

 int c = int.Parse(disichang1.Text);

 if (a == fen && a - 1 > c)

 {MessageBox.Show("第四局" + button2.Text);

 disiju.Text = button2.Text;

 int b = int.Parse(changneibifen2.Text);

 b++;

 changneibifen2.Text = b.ToString();

 }}

 else

 {int a = int.Parse(disichang2.Text);

 a++;

 disichang2.Text = a.ToString();

 int c = int.Parse(diyichang1.Text);

 if (a - 1 > c)

 {MessageBox.Show("第台?四?局?" + button2.Text);

 disiju.Text = button2.Text;

 int b = int.Parse(changneibifen2.Text);

 b++;

 changneibifen2.Text = b.ToString();

 }}}

 else if (txtguojia2.Text != "")

 {int fen = 25;

 if (int.Parse(changneibifen1.Text) == 3)

 {MessageBox.Show(button1.Text);

return;}

 else if (int.Parse(changneibifen2.Text) == 3)

 {MessageBox.Show(button2.Text);

 return;}

 else if (int.Parse(changneibifen1.Text) == 2 || int.Parse(changneibifen2.Text) == 2)

 {fen = 15;}

if (int.Parse(diwuchang2.Text) < fen )

{ int a = int.Parse(diwuchang2.Text);

 a++;

 diwuchang2.Text = a.ToString();

 int c = int.Parse(diwuchang1.Text);

 if (a == fen && a - 1 > c)

 {MessageBox.Show("第五局" + button2.Text);

 diwuju.Text = button2.Text;

 int b = int.Parse(changneibifen2.Text);

 b++;

 changneibifen2.Text = b.ToString();

 }}

 else

 {int a = int.Parse(diwuchang2.Text);

 a++;

 diwuchang2.Text = a.ToString();

 int c = int.Parse(diwuchang1.Text);

 if (a - 1 > c)

 {MessageBox.Show("第五局" + button2.Text);

 diwuju.Text = button2.Text;

 int b = int.Parse(changneibifen2.Text);

b++;

changneibifen2.Text = b.ToString();

 }}}}

private void texguojia1_TextChanged(object sender, EventArgs e)

 {button1.Text = txtguojia1.Text+"Win";}

private void texguojia2_TextChanged(object sender, EventArgs e)

 {button2.Text = txtguojia2.Text+"Win";

}}

代码复审:1h

 

本周作业