2009年6月25日 星期四

Homework 11 5/25 User test

舊版的電子系網頁,感覺有較多的多媒體呈現,但甫進入只有看到幾個簡單的項目,使用者要尋找自己需要的資訊還必須從少數的大項目去思考應該要點哪一個連結,若是不熟悉舊版的網站,很容易在網站上迷路。

而新版的電子系網站架構類似我們常在使用的網誌,雖然沒有太大範圍的多媒體展示,但最新的資訊,教授的公告以及系上的公告都在網頁邊欄清楚得顯示,主頁文章也直接讓我們看到重點,可以提升不少尋找資訊的效率。

我覺得另外最重要的一點是,新版網站的讀取似乎比舊版網頁輕鬆了一些,電腦的流量負擔可以得到減輕。

LAB30 6/15 Hanoi Tower

The pseudocode for Hanoi Tower is as follows:

solve(N, Src, Aux, Dst)
if N is 0 return
solve(N-1, Src, Dst, Aux)
Move N from Src to Dst
solve(N-1, Aux, Src, Dst)


Write the Java program based on the pseudocode in the above.

程式畫面 Recursive Method


程式畫面 Demo program

Homework 12 6/1 Modular Sorting

Write a sort method which takes a double array as parameter
and returns the sorted array. Call this method in a main program.

Hint: The lab is a rewriting of Lab Sorting
to make the sorting procedure a reusable method.


程式畫面 Sorting method


由double[].length取得陣列長度
在將兩個for迴圈組成的排序法放入static method之中。


程式畫面 Demo program

LAB27 6/1 Array

Study Display 6.1, and then write a program that can sort numbers in ascending order.

程式畫面 Array sorting


預設一個整數陣列array,具有五個陣列元素。

使用兩個for迴圈的排序法進行排序。

LAB26 5/25 Static Method II on Complex multiply

Define a Complex class with a static method for computing complex addition. Use (2+3i)*(4+5i) in your test.


程式畫面 Class


Complex 乘積的實部是由原本兩實部相乘再加上原本兩虛部相乘的總合
虛部則為虛部和實部的乘積總合。

故2+3i * 4+5i = 2*4+3i*5i + 2*5i+4*3i
= 8+15(-1) + 10i +12i
= -7 + 22i

程式畫面 Demo

LAB 25 5/25 Magic Parking Tower

A parking tower is out of order someday.
If you park a Benz, you will end up with a Torben.
Write a program to simulate this scenario.
First create a class called CarParked which has a static method called outOfOrder.
Name an object called yourCar, which happens to be a Benz.

Your program should contain a class called CarParked and a test program called CarParkedDemo which test the method by

CarParked.outOfOrder(yourCar).

程式畫面 Class






程式畫面 Demo

LAB24 5/25 Static Mathod on Complex addition

Define a Complex class with a static method for computing complex addition. Use (2+3i)+(4+5i) in your test.


程式畫面 Class definition


Static method add使用兩個Complex物件當引數,
回傳一個Complex物件。


程式畫面 Demo