import java.io.*;
import java.util.Date;
class JVA01{
String[][] items;
long start,end;
Date d;
BufferedReader br;
public static void main(String args[]){
int total=args.length;
int pairs=total/2;
JVA01 tte=new JVA01();
if(total != 0 && pairs != 0){
tte.items=new String[pairs][2];
//請在此撰寫程式
for(int k = 0; k {
tte.items[k][0] = args[k * 2];
tte.items[k][1] = args[k * 2 + 1];
}
}
tte.start();
}
JVA01(){
items=new String[5][2];
items[0][0] = "電腦";
items[0][1] = "Computer";
items[1][0] = "資料庫";
items[1][1] = "DataBase";
items[2][0] = "語法";
items[2][1] = "syntax";
items[3][0] = "學校";
items[3][1] = "School";
items[4][0] = "假期";
items[4][1] = "Vocation";
br=new BufferedReader(new InputStreamReader(System.in));
}
void start(){
String ans="";
int correct=0;
d=new Date();
start=d.getTime();
System.out.println("請將題目的中文詞彙翻譯成英文單字!");
System.out.println("輸入英文單字答案後請按Enter鍵:");
System.out.println(" ");
//請在此撰寫程式
for(int j = 0; j {
System.out.println("第" + (j + 1) + "題__ " + items[j][0]);
try
{
ans = br.readLine();
}
catch(IOException ioexception)
{
System.out.println(ioexception);
}
if(ans.equalsIgnoreCase(items[j][1]))
{
correct++;
System.out.println("答對了 !");
System.out.println(" ");
} else
{
System.out.println("答錯了 !");
System.out.println("正確答案是" + items[j][1]);
System.out.println(" ");
}
//請上方撰寫程式
}
d=new Date();
end=d.getTime();
//請在此撰寫程式
System.out.print("你使用了" + (end - start) / 1000L + "秒, 在");
System.out.println(items.length + "題中答對了" + correct + "題");
}
}
- Nov 10 Sat 2007 16:30
TQC-110-單字測驗
全站熱搜
留言列表
發表留言