第六小组作业

计划:

估计这个任务需要多少时间完成:5-6天

开发:

需求分析:作为一个排球记分员,我希望能够方便的记录分数(精确到每球的的分),以便及时的把分数反映给观众。

设计文档:①排球计分程序的加减分②比赛结果的查询③比赛详细记录的查询

具体设计:

活动图:

具体编写:

详细得每场总比分:

具体代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void jia1_Click(object sender, EventArgs e)
        {
           if(TBC.Text=="第一场")
           {
            if(int.Parse(TB1.Text)<25)
            {
                int a = int.Parse(TB1.Text);
                a++;
                TB1.Text = a.ToString();

                int c = int.Parse(TB2.Text);
                if (a == 25 && a - 1 > c)
                {
                    MessageBox.Show("第一场" + CB1.Text + "");
                    TBC.Text = "第二场";
                    TB1.Text = "0";
                    TB2.Text = "0";
                }
            }
            else
            {
                int a = int.Parse(TB1.Text);
                a++;
                TB1.Text = a.ToString();
                int c = int.Parse(TB2.Text);
                if (a - 1 > c)
                {
                    MessageBox.Show("第一场" + CB1.Text + "");
                    TBC.Text = "第二场";
                    TB1.Text = "0";
                    TB2.Text = "0";
                }
            }
          }
           else if (TBC.Text == "第二场")
           {
               if (int.Parse(TB1.Text) < 25)
               {
                   int a = int.Parse(TB1.Text);
                   a++;
                   TB1.Text = a.ToString();
                   int c = int.Parse(TB2.Text);
                   if (a == 25 && a - 1 > c)
                   {
                       MessageBox.Show("第二场" + CB1.Text + "");
                        TBC.Text = "第三场";
                        TB1.Text = "0";
                        TB2.Text = "0";
                   }
               }
               else
               {
                   int a = int.Parse(TB1.Text);
                   a++;
                   TB1.Text = a.ToString();
                   int c = int.Parse(TB2.Text);
                   if (a - 1 > c)
                   {
                       MessageBox.Show("第二场" + CB1.Text + "");
                       TBC.Text = "第三场";
                       TB1.Text = "0";
                       TB2.Text = "0";
                   }
               }
           }
           else if(TBC.Text=="第三场"){
            if (int.Parse(TB1.Text) < 25)
            {
                int a = int.Parse(TB1.Text);
                a++;
                TB1.Text = a.ToString();
                int c = int.Parse(TB2.Text);
                if (a == 25 && a - 1 > c)
                {
                    MessageBox.Show("第三场" + CB1.Text + "");
                    TBC.Text = "第四场";
                    TB1.Text = "0";
                    TB2.Text = "0";
                }
            }
            else
            {
                int a = int.Parse(TB1.Text);
                a++;
                TB1.Text = a.ToString();
                int c = int.Parse(TB2.Text);
                if (a - 1 > c)
                {
                    MessageBox.Show("第三场" + CB1.Text + "");
                    TBC.Text = "第四场";
                    TB1.Text = "0";
                    TB2.Text = "0";
                }
            }
        }
            else if(TBC.Text=="第四场"){
            if (int.Parse(TB1.Text) < 25)
            {
                int a = int.Parse(TB1.Text);
                a++;
                TB1.Text = a.ToString();
                int c = int.Parse(TB2.Text);
                if (a == 25 && a - 1 > c)
                {
                    MessageBox.Show("第四场" + CB1.Text + "");
                    TBC.Text = "第五场";
                    TB1.Text = "0";
                    TB2.Text = "0";
                }
            }
            else
            {
                int a = int.Parse(TB1.Text);
                a++;
                TB1.Text = a.ToString();
                int c = int.Parse(TB2.Text);
                if (a - 1 > c)
                {
                    MessageBox.Show("第四场" + CB1.Text + "");
                    TBC.Text = "第五场";
                    TB1.Text = "0";
                    TB2.Text = "0";
                }
            }
            }
           else if (TBC.Text == "第五场")
           {
            if (int.Parse(TB1.Text) < 25)
            {
                int a = int.Parse(TB1.Text);
                a++;
                TB1.Text = a.ToString();
                int c = int.Parse(TB2.Text);
                if (a == 25 && a - 1 > c)
                {
                    MessageBox.Show("第五场" + CB1.Text + "");
                    
                }
            }
            else
            {
                int a = int.Parse(TB1.Text);
                a++;
                TB1.Text = a.ToString();
                int c = int.Parse(TB2.Text);
                if (a - 1 > c)
                {
                    MessageBox.Show("第五场" + CB1.Text + "");
                } 
            }
            }
        }

        private void jia2_Click(object sender, EventArgs e)
        {
            if (TBC.Text == "第一场")
            {
                if (int.Parse(TB2.Text) < 25)
                {
                    int a = int.Parse(TB2.Text);
                    a++;
                    TB2.Text = a.ToString();

                    int c = int.Parse(TB1.Text);
                    if (a == 25 && a - 1 > c)
                    {
                        MessageBox.Show("第一场" + CB2.Text + "");
                        TB2.Text = "0";
                        TBC.Text = "第二场";
                        TB1.Text = "0";
                    }
                }

                else
                {
                    int a = int.Parse(TB2.Text);
                    a++;
                    TB2.Text = a.ToString();
                    int c = int.Parse(TB1.Text);
                    if (a - 1 > c)
                    {
                        MessageBox.Show("第一场" + CB2.Text + "");
                        TBC.Text = "第二场";
                        TB2.Text = "0";
                        TB1.Text = "0";
                    }
                }
            }
            else if(TBC.Text=="第二场")
            {
            if (int.Parse(TB2.Text) < 25)
            {
                int a = int.Parse(TB2.Text);
                a++;
                TB2.Text = a.ToString();
                int c = int.Parse(TB1.Text);
                if (a == 25 && a - 1 > c)
                {
                    MessageBox.Show("第二场" + CB2.Text + "");
                    TBC.Text = "第三场";
                    TB2.Text = "0";
                    TB1.Text = "0";
                }
            }
            else
            {
                int a = int.Parse(TB2.Text);
                a++;
                TB2.Text = a.ToString();
                int c = int.Parse(TB1.Text);
                if (a - 1 > c)
                {
                    MessageBox.Show("第二场" + CB2.Text + "");
                    TBC.Text = "第三场";
                    TB2.Text = "0";
                    TB1.Text = "0";
                }
            }
            }
            else if (TBC.Text == "第三场")
            {
                if (int.Parse(TB2.Text) < 25)
                {
                    int a = int.Parse(TB2.Text);
                    a++;
                    TB2.Text = a.ToString();
                    int c = int.Parse(TB1.Text);
                    if (a == 25 && a - 1 > c)
                    {
                        MessageBox.Show("第三场" + CB2.Text + "");
                        TBC.Text = "第四场";
                        TB2.Text = "0";
                        TB1.Text = "0";
                    }
                }
                else
                {
                    int a = int.Parse(TB2.Text);
                    a++;
                    TB2.Text = a.ToString();
                    int c = int.Parse(TB1.Text);
                    if (a - 1 > c)
                    {
                        MessageBox.Show("第三场" + CB2.Text + "");
                        TBC.Text = "第四场";
                        TB2.Text = "0";
                        TB1.Text = "0";
                    }
                }
            }
            else if(TBC.Text=="第四场"){
            if (int.Parse(TB2.Text) < 25)
            {
                int a = int.Parse(TB2.Text);
                a++;
                TB2.Text = a.ToString();
                int c = int.Parse(TB1.Text);
                if (a == 25 && a - 1 > c)
                {
                    MessageBox.Show("第四场" + CB2.Text + "");
                    TBC.Text = "第五场";
                    TB2.Text = "0";
                    TB1.Text = "0";
                }
            }
            else
            {
                int a = int.Parse(TB2.Text);
                a++;
                TB2.Text = a.ToString();
                int c = int.Parse(TB1.Text);
                if (a - 1 > c)
                {
                    MessageBox.Show("第四场" + CB2.Text + "");
                    TBC.Text = "第五场";
                    TB2.Text = "0";
                    TB1.Text = "0";
                }
            }
          }
            else if (TBC.Text == "第五场")
            {
                if (int.Parse(TB2.Text) < 25)
                {
                    int a = int.Parse(TB2.Text);
                    a++;
                    TB2.Text = a.ToString();
                    int c = int.Parse(TB1.Text);
                    if (a == 25 && a - 1 > c)
                    {
                        MessageBox.Show("第五场" + CB2.Text + "");

                    }
                }
                else
                {
                    int a = int.Parse(TB2.Text);
                    a++;
                    TB2.Text = a.ToString();
                    int c = int.Parse(TB1.Text);
                    if (a - 1 > c)
                    {
                        MessageBox.Show("第五场" + CB2.Text + "");

                    }
                }
            }
        }

        private void jian1_Click(object sender, EventArgs e)
        {
            if (TBC.Text == "第一场")
            {
                if (int.Parse(TB1.Text) < 25)
                {
                    int a = int.Parse(TB1.Text);
                   
                    TB1.Text = a.ToString();

                }
                else
                { }

            }
            if (TBC.Text == " 第二场")
            {

                if (int.Parse(TB1.Text) < 25)
                {
                    int a = int.Parse(TB1.Text);
                    
                    TB1.Text = a.ToString();

                }
                else
                { }
            }
            else if (TBC.Text == " 第三场")
            {

                if (int.Parse(TB1.Text) < 25)
                {
                    int a = int.Parse(TB1.Text);
                   
                    TB1.Text = a.ToString();

                }
            }
            else if (TBC.Text == " 第四场")
            {

                if (int.Parse(TB1.Text) < 25)
                {
                    int a = int.Parse(TB1.Text);
                    
                    TB1.Text = a.ToString();

                }
            }
            else if (TBC.Text == " 第五场")
            {

                if (int.Parse(TB1.Text) < 25)
                {
                    int a = int.Parse(TB1.Text);
                    
                    TB1.Text = a.ToString();

                }
            }
        }

        private void jian2_Click(object sender, EventArgs e)
        {
            if (TBC.Text == "第一场")
            {
                if (int.Parse(TB2.Text) < 25)
                {
                    int a = int.Parse(TB2.Text);
                    a--;
                    TB2.Text = a.ToString();

                }

            }
            else if (TBC.Text == " 第二场")
            {

                if (int.Parse(TB2.Text) < 25)
                {
                    int a = int.Parse(TB2.Text);
                   
                    TB2.Text = a.ToString();

                }

            }
            else if (TBC.Text == " 第三场")
            {

                if (int.Parse(TB2.Text) < 25)
                {
                    int a = int.Parse(TB2.Text);
                   
                    TB2.Text = a.ToString();

                }

            }
            else if (TBC.Text == " 第四场")
            {

                if (int.Parse(TB2.Text) < 25)
                {
                    int a = int.Parse(TB2.Text);
                    
                    TB2.Text = a.ToString();



                }
            }
            else if (TBC.Text == " 第五场")
            {

                if (int.Parse(TB2.Text) < 25)
                {
                    int a = int.Parse(TB2.Text);
                    
                    TB2.Text = a.ToString();

                }

            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}

还没有测试。

原文地址:https://www.cnblogs.com/chen-bo/p/6220818.html