ㄟ丟~這是學校JAVA檢定的題目範例...
找來找去就只找到這些題目
是說...其他題目也都是依這些題目去做延申和修改的啦
這回我會通過考試...也是拿這些資料硬湊出來的
其實我也是個程式白痴
就像我之前網誌上有寫過的...找了一堆資料...考題卻一題也沒猜中...想哭到了極點
原本想說至少也會矇中一題吧...結果沒有= =|||
是說學弟妹們加油吧...就算真的不會寫程式...但至少也花些時間上網找一下資料吧
雖然有很多人都會跟你說:"上網找考古題,找到我可以幫你解..."
別太相信這些人的話...根本就沒有所謂的考古題...而且這些人也都是死都不跟你講考古題在哪的人
這種人真的很要不得!!!假好心!!!(有怨念...就是有這樣被對待過>"<)
所以我把自己找到的資料都整理在這
順便做個記錄...
記錄自己為了這些程式題目殺死了多少腦細胞、浪費了多少時間和金錢...>"<
攝氏溫度( C )轉換為華氏溫度( F )的公式為: F=9/5*C+32 。請撰寫一程式 ,利用命令列輸入一個整數攝氏溫度 , 則印出其華氏溫度。 ( 請上傳 Degree.class 檔 )
範例輸入 : >java Degree 54
範例輸出 : 129.2
public class Degree{
public static void main(String[] args){
double c = Integer.parseInt(args[0]);
double f;{
f = (9.0 * c) / 5.0 + 32.0;
System.out.println(f);
}
}
}
設計一程式輸入N(1<N<100)名學生的英文成績,求出英文成績中的最高分數。( 請上傳 MaxScore.class 檔 )
範例輸入 :>java MaxScore 80 70 60 90 50
範例輸出 :90
import java.util.Arrays;
public class MaxScore{
public static void main(String[] args){
int[] n = new int[args.length];
for(int i = 0; i < n.length; i++){
n[i] = Integer.parseInt(args[i]);
}
Arrays.sort(n);
System.out.print(n[n.length - 1]);
}
}
請撰寫一個計算計程車車費的程式,可以輸入里程N公尺,計算出車費。計程車起跳是70元,之後每300公尺加5元,不滿300公尺以300公尺計算。 ( 請上傳 Taxi.class 檔 )
範例輸入 :>java Taxi 2800
範例輸出 : 120
public class Taxi{
public static void main(String[] args){
int n = Integer.parseInt(args[0]);
if (n % 300 > 0){
n = n + 300;
}
System.out.print((n / 300) * 5 + 70);
}
}
有一隻蝸牛和一棵N公尺的大樹(1<N<100),蝸牛白天往上爬3公尺,但晚上會掉下1公尺,請算出幾天可以爬到樹項。 ( 請上傳 Snail.class 檔 )
範例輸入 :>java Snail 76
範例輸出 :38
public class Snail{
public static void main(String[] args){
int n = Integer.parseInt(args[0]);
int day = 0;
for (int m = 0; m <= n, m -= 1){
day = day + 1;
m = m + 3;
if (m >= n)
break;
}
System.out.println(day);
}
}
撰寫一個程式 ,讀入9個整數,並求出這些整數的中間值。( 請上傳 Middle.class 檔 )
範例輸入 : >java Middle 10 20 30 40 5 15 20 25 200
範例輸出 : 20
import java.util.Arrays;
public class Middle{
public static void main(String[] args){
int[] n = new int (args.length);
for (int i = 0; i < n.length; i++){
n[i] = Integer.parseInt(args[i]);
}
Arrays.sort(n);
System.out.print(n[n.length / 2]);
}
}
請設計一程式,輸入一字串S(0<|S|<100),將其字串作反轉。(請上傳 Inverse.class 檔 )
範例輸入 :>java Inverse java
範例輸出 : avaj
public class Inverse{
public static void main(String argv[]){
if (argv.length == 0){
System.out.println("請輸入參數");
}else{
for (int = i = argv[0].length() - 1; i >= 0; i--){
System.out.print(argv[0].charAt(i));
}
}
}
}
請建立 Java程式,讀入一個整數n,並使用迴圈計算下列數學運算式的值: 1*1+2*2+3*3~+n*n 。 ( 請上傳 Series.class 檔 )
範例輸入 :>java Series 5
範例輸出 :55
public class Series{
public static void main(String[] args){
int n = Integer.parseInt(args[0]);
int sum = 0;
for (int i = 1; i <= n; i++){
sum = sum + (i * i);
}
System.out.print(sum);
}
}
讀入一個學生的作業成績、期中考成績、以及期未考成績。如果學生的期末考成績達 70 分 ( 含 ) 以上印出及格,或作業成績 80 分 ( 含 ) 以上且期中考成績不低於 60 分,也印出 ” 及格 ” ,其他則印出 ” 不及格 ” 。 ( 請上傳 Score.class 檔 )
範例輸入 :>java Score 60 75 65
範例輸出 :不及格
public class Score{
public static void main(String[] args){
int n [] = new int [3];
for (int i = 0; i < 3; i++){
n[i] = Integer.parseInt(args[i]);
}
if (n[2] >= 70 || n[0] >= 80 && n[1] >= 60)){
System.out.println("及格');
}else{
System.out.println("不及格");
}
}
}
撰寫一程式 , 輸入一個整數 n (>=3)使用迴圈顯示以下圖形。 ( 請上傳 SquareStars.class 檔 )
範例輸入 :>java SquareStars 5
範例輸出 :
*****
* *
* *
* *
*****
public class SquareStars{
public static void main(String[] args){
int n = Integer.parseInt(args[0]);
for (int i = 1; i <= n; i++){
if (i == 1 || i == n){
for (int j = 1; j <= n; j++){
System.out.print('*');
}
}slse{
for (int j = 1; j <= n; j++){
if (j == 1 || j == n){
System.out.print('*');
}else{
System.out.print(' ');
}
}
}
System.out.println();
}
}
}
◎我可能會有打錯字的部分...如果程式有出錯就檢查一下錯字吧...
還有...我真的是程式白痴...上面的程式都是上網找來的...
所以千萬不要問我程式怎麼寫...我也回答不出來Orz
留言列表