团队成员:陈淑筠、杨家安、陈曦

团队选题:小学四则运算APP

第二次冲刺阶段时间:11.29~12.09

本次发布的是判断题代码,已经实现部分功能,,但是美中不足的是判断错误

panduanset.java

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TextView; public class panduanset extends Activity {
private TextView panduannumber;
private RadioGroup panduanRG;
private int i,g;
private Button panduanxunlian;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_panduan_set);
panduannumber=(TextView)findViewById(R.id.panduannumber);
panduanRG=(RadioGroup)findViewById(R.id.panduangroup);
panduanxunlian=(Button)findViewById(R.id.panduanxunlian);
panduanRG.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override
public void onCheckedChanged(RadioGroup arg0, int arg1) {
// TODO Auto-generated method stub
i=arg1;
}
});
panduanxunlian.setOnClickListener(new OnClickListener() { @Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
g=Integer.valueOf(panduannumber.getText().toString());
Intent intent=new Intent();
Bundle bundle=new Bundle();
bundle.putInt("panduansuanfa", i);
bundle.putInt("panduanshumu",g);
intent.setClass(panduanset.this,panduanActivity.class);
intent.putExtras(bundle);
startActivity(intent);
}
});
} @Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
} }

panduanAcivity.java

import java.util.Random;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TextView; public class panduanActivity extends Activity{
private Button next1;
private Button result1;
private RadioGroup panduan;
private TextView timu1;
private int index,i;
private int k,j,l,sum,wrong,right,sign,label=0;
private char a;
private final Random num1=new Random();
private final Random num2=new Random();
private final Random r = new Random();
private char[] ch = {'+','-','*','/'};
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_panduan);
panduan=(RadioGroup)findViewById(R.id.group2);
next1=(Button)findViewById(R.id.next1);
result1=(Button)findViewById(R.id.result1);
timu1=(TextView)findViewById(R.id.timu1);
Bundle bundle=getIntent().getExtras();
index=bundle.getInt("panduansuanfa");
a=ch[index];
i=bundle.getInt("panduanshumu");
final String []answer=new String[i];
String c=String.valueOf(num1.nextInt(100));
String b=String.valueOf(num2.nextInt(100));
String g=String.valueOf(r.nextInt(3));
k=Integer.valueOf(g);
l=Integer.valueOf(c);
j=Integer.valueOf(b);
String d=String.valueOf(a);
switch(index){
case 0:
sum=l+j;
break;
case 1:
sum=l-j;
break;
case 2:
sum=l*j;
break;
case 4:
sum=l/j;
break;
}
switch(k){
case 0:
timu1.setText(c+d+b+"="+String.valueOf(sum));
right=0;
break;
case 1:
timu1.setText(c+d+b+"="+String.valueOf(sum+1));
right=1;
break;
case 2:
timu1.setText(c+d+b+"="+String.valueOf(sum+2));
right=1;
break;
default:
break;
}
panduan.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override
public void onCheckedChanged(RadioGroup arg0, int arg1) {
// TODO Auto-generated method stub
sign=arg1;
System.out.print(sign);
}
});
next1.setOnClickListener(new OnClickListener() { @Override
public void onClick(View arg0) {
if(i!=0){
if(sign==right){
Toast.makeText(panduanActivity.this, "选择正确", Toast.LENGTH_LONG).show();
answer[label]="right";
}
if(sign!=right){
Toast.makeText(panduanActivity.this, "选择错误", Toast.LENGTH_LONG).show();
answer[label]="wrong";
}
i--;
label++;
String c=String.valueOf(num1.nextInt(100));
String b=String.valueOf(num2.nextInt(100));
String g=String.valueOf(r.nextInt(3));
k=Integer.valueOf(g);
l=Integer.valueOf(c);
j=Integer.valueOf(b);
String d=String.valueOf(a);
switch(index){
case 0:
sum=l+j;
break;
case 1:
sum=l-j;
break;
case 2:
sum=l*j;
break;
case 4:
sum=l/j;
break;
}
switch(k){
case 0:
timu1.setText(c+d+b+"="+String.valueOf(sum));
right=0;
break;
case 1:
timu1.setText(c+d+b+"="+String.valueOf(sum+1));
right=1;
break;
case 2:
timu1.setText(c+d+b+"="+String.valueOf(sum+2));
right=1;
break;
default:
break;
}
panduan.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override
public void onCheckedChanged(RadioGroup arg0, int arg1) {
// TODO Auto-generated method stub
sign=arg1;
System.out.print(sign);
}
});
}
else
{
Toast.makeText(panduanActivity.this,"题目已做完", Toast.LENGTH_LONG).show();
timu1.setText(null);
}
}
});
result1.setOnClickListener(new OnClickListener() { @Override
public void onClick(View arg0) {
if(i!=0)
Toast.makeText(panduanActivity.this, "题目没有做完,请继续完成", Toast.LENGTH_LONG).show();
else{
Intent intent=new Intent();
Bundle bundle2=new Bundle();
intent.setClass(panduanActivity.this,panduanresult.class);
bundle2.putInt("panduannumber", label);
bundle2.putStringArray("panduanarry", answer);
intent.putExtras(bundle2);
startActivity(intent);
} }
});
} @Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
} }

panduanresult.java

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView; public class panduanresult extends Activity{
private TextView t1;
private TextView t2;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_panduan_result);
t1=(TextView)findViewById(R.id.panduan12);
t2=(TextView)findViewById(R.id.panduan13);
Bundle bundle=getIntent().getExtras();
int i=bundle.getInt("panduannumber");
String []answer=bundle.getStringArray("panduanarry");
String aa="";
String aaa="";
for(int g=0;g<i;g++){
aa+=String.valueOf(g+1)+"\n";
aaa+=answer[g]+"\n";
t1.setText(aa);
t2.setText(aaa);;
}
} @Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
} }

小学四则运算APP 第二阶段冲刺-第五天的更多相关文章

  1. 小学四则运算APP 第二阶段冲刺-第三天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第二次冲刺阶段时间:11.29~12.09 本次发布的是判断题的部分代码 panduanset.java import com.examp ...

  2. 小学四则运算APP 第二阶段冲刺

    第一阶段实现最基本的四则运算计算,最原始的所以还没有美化 xml文件     <LinearLayout xmlns:android="http://schemas.android.c ...

  3. 小学四则运算APP 第一个冲刺阶段 第五天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布的是实现练习功能的成功 代码: public class CalculatorActi ...

  4. 小学四则运算APP 第一个冲刺 第八天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布的是还未完成的功能二(选择题): ChoiceActivity.java: packa ...

  5. 小学四则运算APP 第一个冲刺 第七天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布的是完成的功能一: 程序代码: MainActivity代码: import andr ...

  6. 小学四则运算APP 第一个冲刺阶段 第六天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布的是重新排列整齐ResultActivity的布局代码activity_result. ...

  7. 小学四则运算APP 第一个冲刺阶段 第四天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布我们增加了CalculatorsActivity.java.YunsuanActivi ...

  8. 小学四则运算APP 第一个冲刺阶段 第三天

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布是在与团队成员解决了昨天问题的基础上,再增加了几个界面,增加了一些功能,修改与增加的代 ...

  9. 小学四则运算APP 第一阶段冲刺 第二天-补

    团队成员:陈淑筠.杨家安.陈曦 团队选题:小学四则运算APP 第一次冲刺阶段时间:11.17~11.27 本次发布已经解决上次问题,问题是写程序逻辑错误,问题已经修改!我们还增加两个模块的面板设置,如 ...

随机推荐

  1. SAP CRM 开发学习资料和教程整理【不定时更新】

    本文链接:http://www.cnblogs.com/hhelibeb/p/6276929.html 首先是SAP网站上面的相关内容 SAP Customer Relationship Manage ...

  2. Properties集合_list方法与store方法

    Properties集合和流对象结合的功能 list()方法: import java.util.Properties; public class PropertiesDemo { public st ...

  3. 习题 6 字符串(string)和文本

    虽然你已经在程序中写过字符串了,你还没学过它们的用处.在这章习题中我们将使用复杂的字符串来建立一系列的变量,从中你将学到它们的用途.首先我们解释一下字符串是什么 东西. 字符串通常是指你想要展示给别人 ...

  4. linuxserver本地和百度云备份脚本小试

    本地单文件上传脚本.命名uf 这是在本机上做的測试,利用bpcs_uploader脚本实现,仅仅是进行简单的封装.自己主动完好云端文件路径. 技术要点:使用dirname获取文件所在文件夹.使用pwd ...

  5. Python 扩展插件

    扩展插件 我下载的本版自带 pip下载工具 cmd-pip 下载插件 pip install HTMLParser 如果提示版本问题,更新PIP 别用开始里面的CMD 使用管理者权限 请注意差别 输入 ...

  6. 清空visual studio 开发缓存

    C:\Users\Administrator\AppData\Local\Temp\Temporary ASP.NET Files C:\Windows\Microsoft.NET\Framework ...

  7. the security of smart contract- 1

    https://blog.zeppelin.solutions/the-hitchhikers-guide-to-smart-contracts-in-ethereum-848f08001f05 这个 ...

  8. ethereum/EIPs-160 EXP cost increase

    eip title author type category status created 160 EXP cost increase Vitalik Buterin Standards Track ...

  9. 扫盲记-第六篇--Normalization

    深度学习模型中的Normalization 数据经过归一化和标准化后可以加快梯度下降的求解速度,这就是Batch Normalization等技术非常流行的原因,Batch Normalization ...

  10. statefulSet 原理理解

    1.  svc(vip)                       --              deployment 2.headless(none)                --     ...