• 冲刺结果与总结


    PSP:

    1.程序功能:可在VS进程下正常运行。加分,减分以及平局,最后可查看总分数,平局数,精彩进球数和最佳队伍。

    2.时间:初步设计:10min

               界面布局:30min

               代码编写:4h

               代码复审:1h

    3.需求分析:作为一名排球比赛组织人员,我需要知道赛事机制,规则。以及各队的名次

    4.设计文档:

    5.设计复审,代码规范:已完成

    6.具体设计:

    7.具体编码:Form1、2、3代码除构造函数和box、label其他均一样

    namespace 排球计分
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                textBox1.Text = "0";
                textBox2.Text = "0";
                button2.Enabled = false;
                button4.Enabled = false;
                label6.Text = "0";
                label10.Text = "0";
            }
    
            private void button5_Click(object sender, EventArgs e)      //查看结果
            {
                Form2 frm2 = new Form2(textBox1.Text, textBox2.Text,label10.Text);
                if (int.Parse(textBox1.Text) > int.Parse(textBox2.Text) && int.Parse(label6.Text) == 11)
                {
                    MessageBox.Show("A队胜");
                    frm2.Show();
                    this.Hide();
             
                }
                else if (int.Parse(textBox1.Text) < int.Parse(textBox2.Text) && int.Parse(label6.Text) == 11)
                {
                    MessageBox.Show("B队胜");
                    frm2.Show();
                    this.Hide();
                }
                else if (int.Parse(textBox2.Text) == int.Parse(textBox2.Text) && int.Parse(label6.Text) == 11)
                {
                    MessageBox.Show("平局");
                    frm2.Show();
                    this.Hide(); ;
                }
                else
                {
                    MessageBox.Show("请检查计分是否出现错误");
                }
            }
    
            private void button1_Click(object sender, EventArgs e)                         //A队加分
            {
                if (int.Parse(label6.Text) < 11)
                {
                    textBox1.Text = (int.Parse(textBox1.Text) + 1).ToString();
                    label6.Text = (int.Parse(label6.Text) + 1).ToString();
                    button2.Enabled = true;
                }
                else
                {
                    MessageBox.Show("超出得分上限,本场比赛已经进行11局");
                }
            }
    
            private void button2_Click(object sender, EventArgs e)           //A队减分
            {
                if (int.Parse(textBox1.Text) - 1 >= 0)
                {
                    textBox1.Text = (int.Parse(textBox1.Text) - 1).ToString();
                    label6.Text = (int.Parse(label6.Text) - 1).ToString();
                }
                else
                {
                    MessageBox.Show("A队得分为0分,不可进行减分操作");
                    button2.Enabled = false;
                }
            }
    
            private void button3_Click(object sender, EventArgs e)                    //B队加分
            {
                if (int.Parse(label6.Text) < 11)
                {
                    textBox2.Text = (int.Parse(textBox2.Text) + 1).ToString();
                    label6.Text = (int.Parse(label6.Text) + 1).ToString();
                    button4.Enabled = true;
                }
                else
                {
                    MessageBox.Show("超出得分上限,本场比赛已经进行11局");
                }
            }
    
            private void button4_Click(object sender, EventArgs e)                   //B队减分
            {
                if (int.Parse(textBox2.Text) - 1 >= 0)
                {
                    textBox2.Text = (int.Parse(textBox2.Text) - 1).ToString();
                    label6.Text = (int.Parse(label6.Text) - 1).ToString();
                }
                else
                {
                    MessageBox.Show("B队得分为0分,不可进行减分操作");
                    button4.Enabled = false;
                }
            }
    
            private void button8_Click(object sender, EventArgs e)              //平局
            {
    
                if (int.Parse(label6.Text) < 11)
                {
                    label6.Text = (int.Parse(label6.Text) + 1).ToString();
                    label10.Text = (int.Parse(label10.Text) + 1).ToString();
                }
                else
                {
                    MessageBox.Show("本场比赛已经进行11局");
                }
            }
    
            private void button10_Click(object sender, EventArgs e)       //规则说明
            {
                MessageBox.Show("规则为:
        1.本次比赛共三场,每场比赛有十一局
        2.胜者得一分,平局双方都不加分,均记作一局
        3.点击查看结果可进入下一场比赛,并看到本场比分
        4.请遵循比赛规则,操作错误我们会给予提示");
            }
    
            private void button9_Click(object sender, EventArgs e)    //退出软件
            {
                this.Close();
            }
    
            private void button7_Click(object sender, EventArgs e)
            {
                MessageBox.Show("比赛未进行完,无法查看结果");
            }
        }
    }
    View Code
    namespace 排球计分
    {
        public partial class Form4 : Form
        {
            public Form4()
            {
                InitializeComponent();
            }
    
             public Form4(string fen1, string fen2, string fen3, string fen4,string fen5,string fen6, string pingju1jia2, string pingju3)
                : this()
            {
                textBox1.Text = (int.Parse(fen1) + int.Parse(fen3) + int.Parse(fen5)).ToString();
                textBox2.Text = (int.Parse(fen2) + int.Parse(fen4) + int.Parse(fen6)).ToString();
                textBox3.Text = (int.Parse(pingju1jia2) + int.Parse(pingju3)).ToString();
            }
    
    
            private void Form4_Load(object sender, EventArgs e)
            {
                textBox4.Text = "0";
                textBox5.Text = "0";
                if (int.Parse(textBox1.Text) > int.Parse(textBox2.Text))
                {
                    textBox6.Text = "A队";
                }
                else if (int.Parse(textBox1.Text) < int.Parse(textBox2.Text))
                {
                    textBox6.Text = "B队";
                }
                else if (int.Parse(textBox1.Text) == int.Parse(textBox2.Text) && int.Parse(textBox4.Text) > int.Parse(textBox5.Text))
                {
                    textBox6.Text = "A队";
                }
                else if (int.Parse(textBox1.Text) == int.Parse(textBox2.Text) && int.Parse(textBox4.Text) < int.Parse(textBox5.Text))
                {
                    textBox6.Text = "B队";
                }
                else
                {
                    textBox6.Text = "平手";
                }
            }
    
            private void button3_Click(object sender, EventArgs e)        //规则说明
            {
                 this.Close(); 
            }
    
            private void button4_Click(object sender, EventArgs e)        //退出
            {
              MessageBox.Show("规则为:
        1.本次比赛共三场,每场比赛有十一局
        2.胜者得一分,平局双方都不加分,均记作一局
        3.点击查看结果可进入下一场比赛,并看到本场比分
        4.请遵循比赛规则,操作错误我们会给予提示");
            
            }
    
            private void textBox4_TextChanged(object sender, EventArgs e)     //精彩进球
            {
    
                Random ran = new Random();
                int RandKey = ran.Next(1, 10);
                string RandKey2 = Convert.ToString(RandKey);
                textBox4.Text = RandKey2;
            }
    
            private void textBox5_TextChanged(object sender, EventArgs e)    //精彩进球
            {
    
                Random ran = new Random();
                int RandKey = ran.Next(1, 10);
                string RandKey2 = Convert.ToString(RandKey);
                textBox5.Text = RandKey2;
            }
    
            private void textBox3_TextChanged(object sender, EventArgs e)
            {
                
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                Form1 f = new Form1();
                f.Show();
                this.Hide();
            }       
        }
    }
    View Code

    8.代码复审:当平局判分时,选择平局无法撤回,直接为队伍加分,会导致局数+1.其他无异常

    9.测试:正常运行

    10报告与总结:界面并不完善,功能不足。很多地方还无法实现。耗时较长,可制作更好的作品。看到同学们的设计均使用了DataGride,觉得自己做的很菜。为了减轻工作量,没有使用数据库。觉得工作不能这么随心所欲,我会在下来的时间修改程序,没做的都做出来

  • 相关阅读:
    你的系统需要做系统集成测试么?
    测试驱动 ASP.NET MVC 和构建可测试 ASP.NET MVC 应用程序
    RikMigrations 或 Migrator.NET 进行自动化的数据库升级
    单元测试
    C#反射
    J2EE--Struts2基础开发
    Dynamics CRM 客户端的插件调试
    于快速创建 IEqualityComparer<T> 实例的类 Equality<T>
    ToolBox Analysis & Design
    实现$.fn.extend 和$.extend函数
  • 原文地址:https://www.cnblogs.com/YinQianlong/p/6256643.html
Copyright © 2020-2023  润新知