zoukankan      html  css  js  c++  java
  • 团队作业八——第二次团队冲刺(Beta版本)第5天

    团队作业八——第二次团队冲刺(Beta版本)第5天

    一、每个人的工作

    (1) 昨天已完成的工作

    完成界面跳转界面。

    (2) 今天计划完成的工作

    简单模式逻辑代码涉及与相关功能的具体实现

    (3) 工作中遇到的困难

    错题本功能完成过程中遇到一些问题

    (4) 每个人的贡献比

    二、燃尽图


     

    三、代码

    package com.example.asus.app_sizeyunsuan;
    
    import android.os.Environment;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.content.Intent;
    
    import java.io.FileOutputStream;
    import java.util.Random;
    
    import android.view.View;
    import android.widget.EditText;
    import android.widget.TextView;
    import android.widget.Button;
    import android.widget.Toast;
    
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.InputStreamReader;
    
    public class SimtimuActivity extends AppCompatActivity {
    
       public TextView T1;
       public TextView T2;
       public EditText T3;
       public TextView R1;
       public TextView R2;
       public int x;
       public int y;
       public int n;
       public int result;
       public int result1;
       public int number;
       public int flag=0;
    
    
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
    
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_simtimu);
    
            Intent intent = getIntent();
            //T=(EditText)findViewById(R.id.editText2);
            // T.setText(intent.getStringExtra("data"));
            T1 = (TextView) findViewById(R.id.textView4);
            T1.setText("12");
            T2 = (TextView) findViewById(R.id.textView5);
            T2.setText("12");
            T3 = (EditText) findViewById(R.id.editText4);
            T3.setText("24");
            R1 = (TextView) findViewById(R.id.textView2);
            R1.setText("+");
            R2 = (TextView) findViewById(R.id.textView3);
            R2.setText("=");
            number = Integer.parseInt(intent.getStringExtra("data"));
        /*    Button btn=(Button)findViewById(R.id.button3);
            btn.setOnClickListener(new View.OnClickListener()
    
            {
                public void onClick (View view){
                    number--;
                    if (number == 0) {
                        //    T1=(EditText)findViewById(R.id.editText2);
                        T1.setText("over");
                    } else {
                        Random rand = new Random();
                        x = rand.nextInt(10) + 1;
                        y = rand.nextInt(10) + 1;
                        n = rand.nextInt(4);
                        switch (0) {
                            case 0:
                                add();
                                break;
                            case 1:
                                sub();
                                break;
                            case 2:
                                mul();
                                break;
                            case 3:
                                div();
                                break;
                            default:
                                break;
                        }
                    }
                }
            });*/
    
        }
    
    
    
    
        public void add() {
            //   T1=(EditText)findViewById(R.id.editText2);
            T1.setText(String.valueOf(x));
            //    T2=(EditText)findViewById(R.id.editText3);
            T2.setText(String.valueOf(y));
            //     R1=(TextView)findViewById(R.id.textView2);
            R1.setText("+");
            //     R2=(TextView)findViewById(R.id.textView3);
            R2.setText("=");
            x=Integer.parseInt(T1.getText().toString());
            y=Integer.parseInt(T2.getText().toString());
            result=x+y;
        }
        public void sub() {
            //     T1=(EditText)findViewById(R.id.editText2);
            T1.setText(String.valueOf(x));
            //     T2=(EditText)findViewById(R.id.editText3);
            T2.setText(String.valueOf(y));
            //    R1=(TextView)findViewById(R.id.textView2);
            R1.setText("-");
            //    R2=(TextView)findViewById(R.id.textView3);
            R2.setText("=");
            x=Integer.parseInt(T1.getText().toString());
            y=Integer.parseInt(T2.getText().toString());
            result=x-y;
        }
        public void mul() {
            //   T1=(EditText)findViewById(R.id.editText2);
            T1.setText(String.valueOf(x));
            //   T2=(EditText)findViewById(R.id.editText3);
            T2.setText(String.valueOf(y));
            //   R1=(TextView)findViewById(R.id.textView2);
            R1.setText("×");
            //    R2=(TextView)findViewById(R.id.textView3);
            R2.setText("=");
            x=Integer.parseInt(T1.getText().toString());
            y=Integer.parseInt(T2.getText().toString());
            result=x*y;
        }
        public void div() {
            //   T1=(EditText)findViewById(R.id.editText2);
            T1.setText(String.valueOf(x));
            //   T2=(EditText)findViewById(R.id.editText3);
            T2.setText(String.valueOf(y));
            //     R1=(TextView)findViewById(R.id.textView2);
            R1.setText("/");
            //     R2=(TextView)findViewById(R.id.textView3);
            R2.setText("=");
            x=Integer.parseInt(T1.getText().toString());
            y=Integer.parseInt(T2.getText().toString());
            int w=1;
            for(int i=2;i<100;i++){
                if(x%i==0&&y%i==0){
                    w=i;
                }
            }
            x=x/w;y=y/w;
        }
    
    
    
        public void onClickSimtijiao(View view) {
            if (flag == 0) {
                Toast.makeText(this, "回答正确!", Toast.LENGTH_SHORT).show();
            } else {
                result1 = Integer.parseInt(T3.getText().toString());
                if (result == result1) {
                    Toast.makeText(this, "回答正确!", Toast.LENGTH_SHORT).show();
                } else {
                    Toast.makeText(this, "回答错误!", Toast.LENGTH_SHORT).show();
                    writeSDcard(T1.getText().toString()+R1.getText().toString()+T2.getText().toString()+R2.getText().toString()+" "+T3.getText().toString());
                }
    
            }
            flag = 1;
        }
    
        public void onClickSimtimu(View view) {
            flag = 1;
            T3.setText("");
            number--;
            if (number == -1) {
                //    T1=(EditText)findViewById(R.id.editText2);
                Toast.makeText(this, "答题结束!", Toast.LENGTH_SHORT).show();
                Intent intent = new Intent(SimtimuActivity.this, JieguoActivity.class);
                startActivity(intent);
            } else {
                Random rand = new Random();
                x = rand.nextInt(10) + 1;
                y = rand.nextInt(10) + 1;
                n = rand.nextInt(4);
                switch (0) {
                    case 0:
                        add();
                        break;
                    case 1:
                        sub();
                        break;
                    case 2:
                        mul();
                        break;
                    case 3:
                        div();
                        break;
                    default:
                        break;
                }
            }
        }
    
        private void writeSDcard(String str) {
            try {
                // 判断是否存在SD卡
                if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
                    // 获取SD卡的目录
                    File sdDire = Environment.getExternalStorageDirectory();
                    FileOutputStream outFileStream = new FileOutputStream(sdDire.getCanonicalPath() + "/rank.txt",true);
                    outFileStream.write(str.getBytes());
                    outFileStream.close();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

     团队源码仓库地址:https://git.coding.net/lizhiqiang0x01/APP-sizeyunsuan.git

                              https://git.coding.net/lizhiqiang0x01/Beta-APPsizeyunsuan.git

    四、模块部分截图

     

     

    五、项目进展

           今天计划完成的功能——四则运算简单版本的一些功能,错题本功能还没有完全实现(正在赶工中)。完成简单版本后,复杂版本就相对容易了,我们会加快项目速度。

    六、小结

            项目方面:今天实验课较多,晚上又意外补课,所以今天进度稍微慢了一些。团队有针对性的开展了进度会议,会在可控范围内加快速度。

            团队方面:整体而言,情况依旧挺好。团队之间有了更深的感情,互帮互助。每天的任务量可能并不大,但是每个人每天都有自己的收获。一门课程一路走来,收获很多,这便是青春的记忆吧。这种感觉真好。

    七、站立会议图片

     

  • 相关阅读:
    linux系统中如何进入退出vim编辑器,方法及区别
    [转]JAVA的动态代理机制及Spring的实现方式
    mybaties 缓存
    全面分析 Spring 的编程式事务管理及声明式事务管理
    面试(4)-spring-Spring面试题和答案
    vector的多套遍历方案
    【QT】QT下载与安装
    【QT】无需写connect代码关联信号和槽函数
    【QT】第一个QT程序(点击按钮,显示特定文本)
    【QT】error: 'SIGNAL' was not declared in this scope
  • 原文地址:https://www.cnblogs.com/newteam6/p/6895446.html
Copyright © 2011-2022 走看看