關於我自己

我的相片
Welcome to discuss about : Chinese Traditional Medicine and Acupuncture Please send me the email: tccnchsu@gmail.com Chih-Yu Hsu

最新消息

總網頁瀏覽量

2009年4月5日 星期日

第八週

2009/04/24 5:30 下課
2009/04/24 研討會召開 2009/04/24 Conference period
資訊科技國際研討會(International Conference on Advanced Information Technologies, AIT)
http://ait.inf.cyut.edu.tw/#b

(期末考補課)


第八週

// UsingArrays.java -------------------------------------------------------------------------------------------
public class UsingArrays
{
private int intArray[] = { 1, 2, 3, 4, 5, 6 };
public double doubleArray[] = { 8.4, 9.3, 0.2, 7.9, 3.4 };
public UsingArrays()
{
} // end UsingArrays constructor
public static void main( String args[] )
{
} // end main
}
//----------------------------------------------------------------------------------
import java.util.Arrays;
import java.lang.Math;

public class UsingArrays
{
static private int intArray[] = { 1, 2, 3, 4, 5, 6 };
public double doubleArray[] = { 8.4, 9.3, 0.2, 7.9, 3.4 };
public UsingArrays()
{
} // end UsingArrays constructor
public static void main( String args[] )
{
double tmp=0.0;
UsingArrays gundam=new UsingArrays();
Arrays.sort(gundam.doubleArray);



for(int i=0;i<=4;i++ )
{
System.out.println(gundam.doubleArray[i]);
tmp=Math.max(tmp,gundam.doubleArray[i]);
}
System.out.println(tmp);
} // end main


}

------------------------------------------------------------------------------------


------------------------------------------------------------------------------------
【一】、試題編號:11900-930202
【二】、試題名稱:樹狀排序程式
【功能要求】
1.請檢查下列程式中的錯誤,以完成樹狀排序。
2.建立TreeNode class,表樹基本節點及利用insert加入新節點。
3.建立Tree class, 計算樹的排序方法,有inorder,postorder,preorder。
4.輸入十組數字加入樹之節點,並排序後輸出。
5.請依照範例資料檔驗證程式的正確性。
【動作要求】
1、程式執行結果須按試題使用說明第(七)至(九)等項規定設計。
2、執行程式時先以範例資料檔930202.s01進行測試,若完全無誤後,向監評人員要求交卷,並由監評人員以測試檔930202.t01或930202.t02測試程式,並將結果存入930202.w01及930202.w02,以完成測試。
3、測試檔案的筆數(大小)並不同於範例資料檔案。
4、測試檔案型態格式和範例資料檔案相同。
5、程式執行結果,請參照【輸出範例】。
6、將所有程式編譯後之可執行檔或Class檔(以原程式檔名)存入測試磁片,連同原始碼列印於報表上(右上角簽名並註明座號),等評審完畢後繳回。
【限制】 程式中所有類別名稱、方法及方法中的列印與檔案輸入/輸出指令或方法皆不可修改。
【程式碼】
1. TreeTest.java
2. Tree.java
http://www.google.com.tw/search?hl=zh-TW&q=Tree.java+&btnG=Google+%E6%90%9C%E5%B0%8B&meta=&aq=f&oq=


How to Use Trees
http://kaul.inf.fh-bonn-rhein-sieg.de/home/java/sun_tut/uiswing/components/tree.html

6 則留言:

HPS 提到...

//第八週作業 D9539125 黃培熏
public class HPS_008{
public static void main(String[] args)
{
int a=0;
for (int i=0;i<7;i++)
System.out.println((int)Math.floor(Math.random()*42+1));
}
}

BBB 提到...

/*D9539108 陸靖文*/
public class FB06{
public static void main(String[] args){

for(int i=0;i<=6;i++){

double dleto=Math.random()*42+1;
double dleto2=Math.floor(dleto);
int ileto=(int)dleto2;
System.out.println(ileto);
}
}
}

提到...

劉羽程
-----------------------------------

import java.lang.Math;
class myeigthjava
{
public static void main(String args[] )
{
for(double i=0 ; i<=6 ; i++)
{
double dleto=(Math.random()*42)+1;
int oleto=(int)Math.floor(dleto);
System.out.println(oleto );
}
}
}

乃爸 提到...

//應數三甲 徐晟哲 D9538864
import java.util.Arrays;
import java.lang.Math;
public class Myeighttwojava
{
public static void main( String args[] )
{

for(int i=0;i<=6;i++){

System.out.println((int)Math.floor(Math.random()*42)+1);
}
}
}

Ataraxia 提到...

//光電四 D9427925 施宇鴻

import java.util.*;
import java.lang.Math;

public class Myeightjava
{
public static void main(String[] args)
{
UsingArrays exia = new UsingArrays();
Arrays.sort(exia.doubleArrays);
double tmp;
for (int i = 0; i <= 5; i++){
tmp = Math.random()*42+1;
int itmp =(int)tmp;
System.out.println(itmp);
}
}
}

Unknown 提到...

/*D9476668 陳秋宇*/

import java.lang.Math;

class Myeightthjava
{
public static void main(String[] args)
{

for (int i=1;i<=6;i++)
{
int r=(int)(Math.random()*42+1);
System.out.println(r);
}

}

}