我正在做一个智商测试应用程序。我考虑测试者确定智商(以我的方式)所花费的时间,但是我遇到了问题。如果我只考虑花费的时间智商会因为它而非常高如果你选择了正确或错误的答案并不重要。那么,我考虑的是时间回答正确的问题。我想从这个方面我可以近距离观察智商。有人帮忙吗?
这是AgeCalculation.java
package com.example.iqtest;
public class AgeCalculation extends Activity implements OnTouchListener
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_age_calculation);
mDate = (EditText) findViewById(R.id.edDate);
age = (EditText) findViewById(R.id.edAge);
calage = (Button) findViewById(R.id.btnCalculateAge);
go = (Button) findViewById(R.id.button1);
category=(EditText) findViewById(R.id.category);
final Calendar c = Calendar.getInstance();
Year = c.get(Calendar.YEAR);
Month = c.get(Calendar.MONTH);
Day = c.get(Calendar.DAY_OF_MONTH);
mDate.setOnTouchListener(this);
calage.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v){
Calendar now= Calendar.getInstance();
Calendar calendar = Calendar.getInstance();
calendar.set(Year, Month, Day);
int years = now.get(Calendar.YEAR) - calendar.get(Calendar.YEAR);
int months = now.get(Calendar.MONTH) - calendar.get(Calendar.MONTH);
int days = now.get(Calendar.DAY_OF_MONTH) - calendar.get(Calendar.DAY_OF_MONTH);
if (days < 0){
months --;
days +=now.getActualMaximum(Calendar.DAY_OF_MONTH);
}
if (months < 0){
years --;
months +=12;
}
String yearsold = years+" YEARS "+months+ " MONTHS "+days+" DAYS"+" "+"OLD";
age.setText(yearsold);
if(years>=0 && years<=10)
{
opt=0;
}else if(years>=11 && years<=15)
{
opt=1;
}else if(years>=16 && years<=30)
{
opt=2;
}
else if(years>=31 && years<=50)
{
opt=3;
}else if(years>=51 && years<=120)
{
opt=4;
}else
{
opt=5;
}
switch (opt) {
case 0:
start=0;
end=21;
indtime=10;
temp=" KIDS";
timetotake=480;
break;
case 1:
start=21;
end=38;
indtime=11;
temp=" CHILDREN";
timetotake=480;
break;
case 2:
start=38;
end=56;
indtime=12;
temp="TEENAGERS";
timetotake=540;
break;
case 3:
start=56;
end=76;
indtime=11;
temp="ADULTS";
timetotake=540;
break;
case 4:
start=76;
end=99;
indtime=13;
temp="ELDERS";
timetotake=600;
break;
case 5:
temp="ALIENS!!";
break;
default:
temp="ALIENS!!";
break;
}
category.setText(temp);
go.setText("GO"+" "+"TO"+" "+temp+" "+"IQTEST");
}
});
go = (Button) findViewById(R.id.buttongo);
go.setOnClickListener(new View.OnClickListener()
{
public void onClick(View view)
{
Intent intent = new Intent(AgeCalculation.this, QuizActivity.class);
startActivity(intent);
}
});
}
@Override
protected Dialog onCreateDialog(int id)
{
switch (id) {
case DATE_DIALOG_ID:
return new DatePickerDialog(
this, DateSetListener, Year, Month, Day);
}
return null;
}
private DatePickerDialog.OnDateSetListener DateSetListener =
new DatePickerDialog.OnDateSetListener()
{
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear,
int dayOfMonth) {
Year = year;
Month = monthOfYear;
Day = dayOfMonth;
String sdate = lp(Day + "", "0", 2)+ " " + montharray[Month] + " " + Year;
mDate.setText(sdate);
}
};
private String lp(String sc, String sp, int len) {
String sr = sc;
for (int i = sr.length(); i < len; i++) {
sr = sp + sr;
}
return new String(sr);
}
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
showDialog(DATE_DIALOG_ID);
return false;
}
}
这是QuizActivity.java
package com.example.iqtest;
public class QuizActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quiz);
timerValue = (TextView) findViewById(R.id.textView2);
startTime = SystemClock.uptimeMillis();
customHandler.postDelayed(updateTimerThread, 0);
pause = (Button) findViewById(R.id.pause);
pause.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
timeSwapBuff += timeInMilliseconds;
customHandler.removeCallbacks(updateTimerThread);
pause.setVisibility(View.VISIBLE);
Intent i = new Intent(QuizActivity.this,Timeplease.class);
startActivity(i);
}
});
agecal = (Button) findViewById(R.id.buttoncalage);
agecal.setOnClickListener(new View.OnClickListener()
{
public void onClick(View view)
{
Intent i = new Intent(QuizActivity.this,AgeCalculation.class);
startActivity(i);
finish();
}
});
DbHelper db=new DbHelper(this);
quesList=db.getAllQuestions();
currentQ=quesList.get(start);
txtQuestion=(TextView)findViewById(R.id.textView1);
rda=(RadioButton)findViewById(R.id.radio0);
rdb=(RadioButton)findViewById(R.id.radio1);
rdc=(RadioButton)findViewById(R.id.radio2);
rdd=(RadioButton)findViewById(R.id.radio3);
rde=(RadioButton)findViewById(R.id.radio4);
butNext=(Button)findViewById(R.id.button1);
setQuestionView();
butNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RadioGroup grp=(RadioGroup)findViewById(R.id.radioGroup1);
RadioButton answer=(RadioButton)findViewById(grp.getCheckedRadioButtonId());
if(currentQ.getanswer().equals(answer.getText()))
{
score++;
}
if(start<end){
currentQ=quesList.get(start);
setQuestionView();
}else{
Intent intent = new Intent(QuizActivity.this, ResultActivity.class);
Bundle b = new Bundle();
b.putInt("score", score);
b.putInt("time",secs);
//Your score
intent.putExtras(b); //Put your score to your next Intent
startActivity(intent);
finish();
}
}
});
}
private void setQuestionView()
{
txtQuestion.setText(currentQ.getquestion());
rda.setText(currentQ.getopta());
rdb.setText(currentQ.getoptb());
rdc.setText(currentQ.getoptc());
rdd.setText(currentQ.getoptd());
rde.setText(currentQ.getopte());
start++;
}
private Runnable updateTimerThread = new Runnable() {
public void run() {
timeInMilliseconds = SystemClock.uptimeMillis() - startTime;
updatedTime = timeSwapBuff + timeInMilliseconds;
secs = (int) (updatedTime / 1000);
int mins = secs / 60;
secs = secs % 60;
int milliseconds = (int) (updatedTime % 1000);
timerValue.setText("" + mins + ":" + String.format("%02d", secs) + ":"+ String.format("%03d", milliseconds));customHandler.postDelayed(this, 0);
}
};
@Override
protected void onResume() {
super.onResume();
startTime = SystemClock.uptimeMillis();
customHandler.postDelayed(updateTimerThread, 0);
}
}
答案 0 :(得分:0)
我会说你应该检查在指定时间内有多少问题被正确回答,像那样检查
不要只是时间
每次用户按下问题的答案时,检查他是否点击了正确的答案并保持标签在1分钟内他正确回答了多少问题,如果他在一分钟内正确回答了5个问题,那么IQ是高,如果1然后低,这样的东西
希望测试15分钟有15个问题 创建一个1分钟的时间任务并将分数复制到矢量或arraylist中,并在每次计时器任务开始时设置得分= 0
你的时间任务应该在测试结束时结束,
当测试时间结束时,检查arraylist的大小并将其添加到arraylist中
如果arrylist大小为15且正确的问题也是15,那么根据需要给它s%,依此类推