標題:
110單數測驗
[打印本頁]
作者:
may
時間:
2012-2-11 09:52
標題:
110單數測驗
使用者可選擇自由出題及預設題目方式進行測驗......
作者:
TOM
時間:
2012-2-12 21:00
本帖最後由 TOM 於 2012-2-18 10:05 編輯
) i/ j- J: ?% }5 x" }5 w
import java.io.*;
import java.util.*;
public class jva110
{
public static void main(String arg[])
{
//取得出題數量
int userItemCoount = arg.length / 2;
//是否為使用者出題(自由出題)
Boolean isUserItem = (userItemCoount > 0);
//宣告題目陣列
String itemQue[];
String itemAns[];
//判斷是否是自由出題
if(isUserItem)
{
//是自由出題
//建立陣列
itemQue = new String[userItemCoount];
itemAns = new String[userItemCoount];
//寫入題目
for(int i=0;i<arg.length;i+=2)
{
itemQue[i/2] = arg[i];
itemAns[i/2] = arg[i+1];
}
}else{
//是預設題目
itemQue = new String[]{"電腦","資料庫","語法","學校","假期"};
itemAns = new String[]{"computer","database","syntax","school","Vocation"};
}
//紀錄開始時間
long startTime = new Date().getTime();
//顯示資訊
System.out.println("請將題目的中文字彙翻譯成英文單字!");
System.out.println("輸入英文單字答案後請按Enter鍵:\n");
//輸入擷取物件
Scanner scanner =new Scanner(System.in);
//宣告答對題目數變數
int Right=0;
//開始出題
for(int i=0;i<itemQue.length;i++)
{
System.out.println("第" + (i+1) +"題__ " + itemQue[i]);
String useInput = scanner.next();
String ans = itemAns[i].toLowerCase();
useInput = useInput.toLowerCase();
if(useInput.equals(ans))
{
System.out.println("答對了!");
Right++;
}else{
System.out.println("答錯了!");
System.out.println("正確答案是" + itemAns[i]+"\n");
}
}
//結算時間
long endTime = new Date().getTime();
long useTime = (endTime-startTime)/1000;
System.out.println("你使用了" + useTime + "秒,在" + itemQue.length + "題中答對了" + Right + "題");
}
}
複製代碼
作者:
TOM
時間:
2012-2-18 10:16
import java.io.*;
import java.util.*;
public class jva110
{
public static void main(String arg[])
{
if(arg.length%2!=0)
{
System.out.println("參數不符");
return ;
}
//取得出題數量
int userItemCoount = arg.length / 2;
//是否為使用者出題(自由出題)
Boolean isUserItem = (userItemCoount > 0);
//宣告題目陣列
String itemQue[];
String itemAns[];
//判斷是否是自由出題
if(isUserItem)
{
//是自由出題
//建立陣列
itemQue = new String[userItemCoount];
itemAns = new String[userItemCoount];
//寫入題目
for(int i=0;i<arg.length;i+=2)
{
itemQue[i/2] = arg[i];
itemAns[i/2] = arg[i+1];
}
}else{
//是預設題目
itemQue = new String[]{"電腦","資料庫","語法","學校","假期"};
itemAns = new String[]{"computer","database","syntax","school","Vocation"};
}
//紀錄開始時間
long startTime = new Date().getTime();
//顯示資訊
System.out.println("請將題目的中文字彙翻譯成英文單字!");
System.out.println("輸入英文單字答案後請按Enter鍵:\n");
//輸入擷取物件
Scanner scanner =new Scanner(System.in);
//宣告答對題目數變數
int Right=0;
//開始出題
for(int i=0;i<itemQue.length;i++)
{
System.out.println("第" + (i+1) +"題__ " + itemQue[i]);
String useInput = scanner.next();
String ans = itemAns[i].toLowerCase();
useInput = useInput.toLowerCase();
if(useInput.equals(ans))
{
System.out.println("答對了!");
Right++;
}else{
System.out.println("答錯了!");
System.out.println("正確答案是" + itemAns[i]+"\n");
}
}
//結算時間
long endTime = new Date().getTime();
long useTime = (endTime-startTime)/1000;
System.out.println("你使用了" + useTime + "秒,在" + itemQue.length + "題中答對了" + Right + "題");
}
}
複製代碼
作者:
johnson
時間:
2012-2-18 10:27
import java.io.*;
import java.util.*;
public class jva110
{
public static void main(String arg[])
{
int userItemCoount = arg.length / 2;
Boolean isUserItem = (userItemCoount > 0);
String itemQue[];
String itemAns[];
if(isUserItem)
{
itemQue = new String[userItemCoount];
itemAns = new String[userItemCoount];
for(int i=0;i<arg.length;i+=2)
{
itemQue[i/2] = arg[i];
itemAns[i/2] = arg[i+1];
}
}
else
{
itemQue = new String[]{"電腦","資料庫","語法","學校","假期"};
itemAns = new String[]{"computer","database","syntax","school","Vocation"};
}
long startTime = new Date().getTime();
System.out.println("請將題目的中文字彙翻譯成英文單字!");
System.out.println("輸入英文單字答案後請按Enter鍵:\n");
Scanner scanner =new Scanner(System.in);
int Right=0;
for(int i=0;i<itemQue.length;i++)
{
.out.println("第" + (i+1) +"題__ " + itemQue[i]);
String useInput = scanner.next();
String ans = itemAns[i].toLowerCase();
useInput = useInput.toLowerCase();
if(useInput.equals(ans))
{
System.out.println("答對了!");
Right++;
}
else
{
System.out.println("答錯了!");
System.out.println("正確答案是" + itemAns[i]+"\n");
}
}
long endTime = new Date().getTime();
long useTime = (endTime-startTime)/1000;
System.out.println("你使用了" + useTime + "秒,在" + itemQue.length + "題中答對了" + Right + "題");
}
}
複製代碼
作者:
kim
時間:
2012-2-18 10:29
import java.io.*;
import java.util.*;
public class jva110
{
public static void main(String arg[])
{
if(arg.length%2!=0)
{
System.out.println("參數不符");
return ;
}
//取得出題數量
int userItemCoount = arg.length / 2;
//是否為使用者出題(自由出題)
Boolean isUserItem = (userItemCoount > 0);
//宣告題目陣列
String itemQue[];
String itemAns[];
//判斷是否是自由出題
if(isUserItem)
{
//是自由出題
//建立陣列
itemQue = new String[userItemCoount];
itemAns = new String[userItemCoount];
//寫入題目
for(int i=0;i<arg.length;i+=2)
{
itemQue[i/2] = arg[i];
itemAns[i/2] = arg[i+1];
}
}else{
//是預設題目
itemQue = new String[]{"電腦","資料庫","語法","學校","假期"};
itemAns = new String[]{"computer","database","syntax","school","Vocation"};
}
//紀錄開始時間
long startTime = new Date().getTime();
//顯示資訊
System.out.println("請將題目的中文字彙翻譯成英文單字!");
System.out.println("輸入英文單字答案後請按Enter鍵:\n");
//輸入擷取物件
Scanner scanner =new Scanner(System.in);
//宣告答對題目數變數
int Right=0;
//開始出題
for(int i=0;i<itemQue.length;i++)
{
System.out.println("第" + (i+1) +"題__ " + itemQue[i]);
String useInput = scanner.next();
String ans = itemAns[i].toLowerCase();
useInput = useInput.toLowerCase();
if(useInput.equals(ans))
{
System.out.println("答對了!");
Right++;
}else{
System.out.println("答錯了!");
System.out.println("正確答案是" + itemAns[i]+"\n");
}
}
//結算時間
long endTime = new Date().getTime();
long useTime = (endTime-startTime)/1000;
System.out.println("你使用了" + useTime + "秒,在" + itemQue.length + "題中答對了" + Right + "題");
}
}
複製代碼
作者:
johnson
時間:
2012-7-16 09:14
import java.io.*;
import java.util.*;
public class TQC110 {
public static void main(String arg[]) {
int userItemCoount = arg.length / 2;
Boolean isUserItem = (userItemCoount > 0);
String itemQue[];
String itemAns[];
if (isUserItem) {
itemQue = new String[userItemCoount];
itemAns = new String[userItemCoount];
for (int i = 0; i < arg.length; i += 2) {
itemQue[i / 2] = arg[i];
itemAns[i / 2] = arg[i + 1];
}
} else {
itemQue = new String[] { "電腦", "資料庫", "語法", "學校", "假期" };
itemAns = new String[] { "computer", "database", "syntax",
"school", "Vocation" };
}
long startTime = new Date().getTime();
System.out.println("請將題目的中文字彙翻譯成英文單字!");
System.out.println("輸入英文單字答案後請按Enter鍵:\n");
Scanner scanner = new Scanner(System.in);
int Right = 0;
for (int i = 0; i < itemQue.length; i++) {
System.out.println("第" + (i + 1) + "題__ " + itemQue[i]);
String useInput = scanner.next();
String ans = itemAns[i].toLowerCase();
useInput = useInput.toLowerCase();
if (useInput.equals(ans)) {
System.out.println("答對了!");
Right++;
} else {
System.out.println("答錯了!");
System.out.println("正確答案是" + itemAns[i] + "\n");
}
}
long endTime = new Date().getTime();
long useTime = (endTime - startTime) / 1000;
System.out.println("你使用了" + useTime + "秒,在" + itemQue.length + "題中答對了"
+ Right + "題");
}
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2