您的位置:首页 > 其它

第十六周个人作业

2016-12-24 20:57 253 查看
计划:

估计需要4-5天

开发:

需求分析:

用户故事:作为一个观众,我希望了解某一场比赛的比分,以便了解赛况。(满意条件:精确到每一局的结果比分)。

从分析用例故事可以知道完成此程序需要这两项任务:选择队伍和查询比赛记录。

生成文档:画了构图

设计复审:无

代码规范:

使用vs2010

具体设计:

下面是活动图:



具体代码:

1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Linq;
7 using System.Text;
8 using System.Windows.Forms;
9
10 namespace WindowsFormsApplication1
11 {
12     public partial class Form1 : Form
13     {
14         public Form1()
15         {
16             InitializeComponent();
17         }
18
19         private void jia1_Click(object sender, EventArgs e)
20         {
21            if(TBC.Text=="第一场")
22            {
23             if(int.Parse(TB1.Text)<25)
24             {
25                 int a = int.Parse(TB1.Text);
26                 a++;
27                 TB1.Text = a.ToString();
28
29                 int c = int.Parse(TB2.Text);
30                 if (a == 25 && a - 1 > c)
31                 {
32                     MessageBox.Show("第一场" + CB1.Text + "赢");
33                     TBC.Text = "第二场";
34                     TB1.Text = "0";
35                     TB2.Text = "0";
36                 }
37             }
38             else
39             {
40                 int a = int.Parse(TB1.Text);
41                 a++;
42                 TB1.Text = a.ToString();
43                 int c = int.Parse(TB2.Text);
44                 if (a - 1 > c)
45                 {
46                     MessageBox.Show("第一场" + CB1.Text + "赢");
47                     TBC.Text = "第二场";
48                     TB1.Text = "0";
49                     TB2.Text = "0";
50                 }
51             }
52           }
53            else if (TBC.Text == "第二场")
54            {
55                if (int.Parse(TB1.Text) < 25)
56                {
57                    int a = int.Parse(TB1.Text);
58                    a++;
59                    TB1.Text = a.ToString();
60                    int c = int.Parse(TB2.Text);
61                    if (a == 25 && a - 1 > c)
62                    {
63                        MessageBox.Show("第二场" + CB1.Text + "赢");
64                         TBC.Text = "第三场";
65                         TB1.Text = "0";
66                         TB2.Text = "0";
67                    }
68                }
69                else
70                {
71                    int a = int.Parse(TB1.Text);
72                    a++;
73                    TB1.Text = a.ToString();
74                    int c = int.Parse(TB2.Text);
75                    if (a - 1 > c)
76                    {
77                        MessageBox.Show("第二场" + CB1.Text + "赢");
78                        TBC.Text = "第三场";
79                        TB1.Text = "0";
80                        TB2.Text = "0";
81                    }
82                }
83            }
84            else if(TBC.Text=="第三场"){
85             if (int.Parse(TB1.Text) < 25)
86             {
87                 int a = int.Parse(TB1.Text);
88                 a++;
89                 TB1.Text = a.ToString();
90                 int c = int.Parse(TB2.Text);
91                 if (a == 25 && a - 1 > c)
92                 {
93                     MessageBox.Show("第三场" + CB1.Text + "赢");
94                     TBC.Text = "第四场";
95                     TB1.Text = "0";
96                     TB2.Text = "0";
97                 }
98             }
99             else
100             {
101                 int a = int.Parse(TB1.Text);
102                 a++;
103                 TB1.Text = a.ToString();
104                 int c = int.Parse(TB2.Text);
105                 if (a - 1 > c)
106                 {
107                     MessageBox.Show("第三场" + CB1.Text + "赢");
108                     TBC.Text = "第四场";
109                     TB1.Text = "0";
110                     TB2.Text = "0";
111                 }
112             }
113         }
114             else if(TBC.Text=="第四场"){
115             if (int.Parse(TB1.Text) < 25)
116             {
117                 int a = int.Parse(TB1.Text);
118                 a++;
119                 TB1.Text = a.ToString();
120                 int c = int.Parse(TB2.Text);
121                 if (a == 25 && a - 1 > c)
122                 {
123                     MessageBox.Show("第四场" + CB1.Text + "赢");
124                     TBC.Text = "第五场";
125                     TB1.Text = "0";
126                     TB2.Text = "0";
127                 }
128             }
129             else
130             {
131                 int a = int.Parse(TB1.Text);
132                 a++;
133                 TB1.Text = a.ToString();
134                 int c = int.Parse(TB2.Text);
135                 if (a - 1 > c)
136                 {
137                     MessageBox.Show("第四场" + CB1.Text + "赢");
138                     TBC.Text = "第五场";
139                     TB1.Text = "0";
140                     TB2.Text = "0";
141                 }
142             }
143             }
144            else if (TBC.Text == "第五场")
145            {
146             if (int.Parse(TB1.Text) < 25)
147             {
148                 int a = int.Parse(TB1.Text);
149                 a++;
150                 TB1.Text = a.ToString();
151                 int c = int.Parse(TB2.Text);
152                 if (a == 25 && a - 1 > c)
153                 {
154                     MessageBox.Show("第五场" + CB1.Text + "赢");
155
156                 }
157             }
158             else
159             {
160                 int a = int.Parse(TB1.Text);
161                 a++;
162                 TB1.Text = a.ToString();
163                 int c = int.Parse(TB2.Text);
164                 if (a - 1 > c)
165                 {
166                     MessageBox.Show("第五场" + CB1.Text + "赢");
167                 }
168             }
169             }
170         }
171
172         private void jia2_Click(object sender, EventArgs e)
173         {
174             if (TBC.Text == "第一场")
175             {
176                 if (int.Parse(TB2.Text) < 25)
177                 {
178                     int a = int.Parse(TB2.Text);
179                     a++;
180                     TB2.Text = a.ToString();
181
182                     int c = int.Parse(TB1.Text);
183                     if (a == 25 && a - 1 > c)
184                     {
185                         MessageBox.Show("第一场" + CB2.Text + "赢");
186                         TB2.Text = "0";
187                         TBC.Text = "第二场";
188                         TB1.Text = "0";
189                     }
190                 }
191
192                 else
193                 {
194                     int a = int.Parse(TB2.Text);
195                     a++;
196                     TB2.Text = a.ToString();
197                     int c = int.Parse(TB1.Text);
198                     if (a - 1 > c)
199                     {
200                         MessageBox.Show("第一场" + CB2.Text + "赢");
201                         TBC.Text = "第二场";
202                         TB2.Text = "0";
203                         TB1.Text = "0";
204                     }
205                 }
206             }
207             else if(TBC.Text=="第二场")
208             {
209             if (int.Parse(TB2.Text) < 25)
210             {
211                 int a = int.Parse(TB2.Text);
212                 a++;
213                 TB2.Text = a.ToString();
214                 int c = int.Parse(TB1.Text);
215                 if (a == 25 && a - 1 > c)
216                 {
217                     MessageBox.Show("第二场" + CB2.Text + "赢");
218                     TBC.Text = "第三场";
219                     TB2.Text = "0";
220                     TB1.Text = "0";
221                 }
222             }
223             else
224             {
225                 int a = int.Parse(TB2.Text);
226                 a++;
227                 TB2.Text = a.ToString();
228                 int c = int.Parse(TB1.Text);
229                 if (a - 1 > c)
230                 {
231                     MessageBox.Show("第二场" + CB2.Text + "赢");
232                     TBC.Text = "第三场";
233                     TB2.Text = "0";
234                     TB1.Text = "0";
235                 }
236             }
237             }
238             else if (TBC.Text == "第三场")
239             {
240                 if (int.Parse(TB2.Text) < 25)
241                 {
242                     int a = int.Parse(TB2.Text);
243                     a++;
244                     TB2.Text = a.ToString();
245                     int c = int.Parse(TB1.Text);
246                     if (a == 25 && a - 1 > c)
247                     {
248                         MessageBox.Show("第三场" + CB2.Text + "赢");
249                         TBC.Text = "第四场";
250                         TB2.Text = "0";
251                         TB1.Text = "0";
252                     }
253                 }
254                 else
255                 {
256                     int a = int.Parse(TB2.Text);
257                     a++;
258                     TB2.Text = a.ToString();
259                     int c = int.Parse(TB1.Text);
260                     if (a - 1 > c)
261                     {
262                         MessageBox.Show("第三场" + CB2.Text + "赢");
263                         TBC.Text = "第四场";
264                         TB2.Text = "0";
265                         TB1.Text = "0";
266                     }
267                 }
268             }
269             else if(TBC.Text=="第四场"){
270             if (int.Parse(TB2.Text) < 25)
271             {
272                 int a = int.Parse(TB2.Text);
273                 a++;
274                 TB2.Text = a.ToString();
275                 int c = int.Parse(TB1.Text);
276                 if (a == 25 && a - 1 > c)
277                 {
278                     MessageBox.Show("第四场" + CB2.Text + "赢");
279                     TBC.Text = "第五场";
280                     TB2.Text = "0";
281                     TB1.Text = "0";
282                 }
283             }
284             else
285             {
286                 int a = int.Parse(TB2.Text);
287                 a++;
288                 TB2.Text = a.ToString();
289                 int c = int.Parse(TB1.Text);
290                 if (a - 1 > c)
291                 {
292                     MessageBox.Show("第四场" + CB2.Text + "赢");
293                     TBC.Text = "第五场";
294                     TB2.Text = "0";
295                     TB1.Text = "0";
296                 }
297             }
298           }
299             else if (TBC.Text == "第五场")
300             {
301                 if (int.Parse(TB2.Text) < 25)
302                 {
303                     int a = int.Parse(TB2.Text);
304                     a++;
305                     TB2.Text = a.ToString();
306                     int c = int.Parse(TB1.Text);
307                     if (a == 25 && a - 1 > c)
308                     {
309                         MessageBox.Show("第五场" + CB2.Text + "赢");
310
311                     }
312                 }
313                 else
314                 {
315                     int a = int.Parse(TB2.Text);
316                     a++;
317                     TB2.Text = a.ToString();
318                     int c = int.Parse(TB1.Text);
319                     if (a - 1 > c)
320                     {
321                         MessageBox.Show("第五场" + CB2.Text + "赢");
322
323                     }
324                 }
325             }
326         }
327
328         private void jian1_Click(object sender, EventArgs e)
329         {
330             if (TBC.Text == "第一场")
331             {
332                 if (int.Parse(TB1.Text) < 25)
333                 {
334                     int a = int.Parse(TB1.Text);
335
336                     TB1.Text = a.ToString();
337
338                 }
339                 else
340                 { }
341
342             }
343             if (TBC.Text == " 第二场")
344             {
345
346                 if (int.Parse(TB1.Text) < 25)
347                 {
348                     int a = int.Parse(TB1.Text);
349
350                     TB1.Text = a.ToString();
351
352                 }
353                 else
354                 { }
355             }
356             else if (TBC.Text == " 第三场")
357             {
358
359                 if (int.Parse(TB1.Text) < 25)
360                 {
361                     int a = int.Parse(TB1.Text);
362
363                     TB1.Text = a.ToString();
364
365                 }
366             }
367             else if (TBC.Text == " 第四场")
368             {
369
370                 if (int.Parse(TB1.Text) < 25)
371                 {
372                     int a = int.Parse(TB1.Text);
373
374                     TB1.Text = a.ToString();
375
376                 }
377             }
378             else if (TBC.Text == " 第五场")
379             {
380
381                 if (int.Parse(TB1.Text) < 25)
382                 {
383                     int a = int.Parse(TB1.Text);
384
385                     TB1.Text = a.ToString();
386
387                 }
388             }
389         }
390
391         private void jian2_Click(object sender, EventArgs e)
392         {
393             if (TBC.Text == "第一场")
394             {
395                 if (int.Parse(TB2.Text) < 25)
396                 {
397                     int a = int.Parse(TB2.Text);
398                     a--;
399                     TB2.Text = a.ToString();
400
401                 }
402
403             }
404             else if (TBC.Text == " 第二场")
405             {
406
407                 if (int.Parse(TB2.Text) < 25)
408                 {
409                     int a = int.Parse(TB2.Text);
410
411                     TB2.Text = a.ToString();
412
413                 }
414
415             }
416             else if (TBC.Text == " 第三场")
417             {
418
419                 if (int.Parse(TB2.Text) < 25)
420                 {
421                     int a = int.Parse(TB2.Text);
422
423                     TB2.Text = a.ToString();
424
425                 }
426
427             }
428             else if (TBC.Text == " 第四场")
429             {
430
431                 if (int.Parse(TB2.Text) < 25)
432                 {
433                     int a = int.Parse(TB2.Text);
434
435                     TB2.Text = a.ToString();
436
437
438
439                 }
440             }
441             else if (TBC.Text == " 第五场")
442             {
443
444                 if (int.Parse(TB2.Text) < 25)
445                 {
446                     int a = int.Parse(TB2.Text);
447
448                     TB2.Text = a.ToString();
449
450                 }
451
452             }
453         }
454
455         private void Form1_Load(object sender, EventArgs e)
456         {
457
458         }
459     }
460 }




代码复审:40min

根据程序关于测试和报告接下来完成。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: