Java
2008年12月22日 星期一
Lab 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.
Lab Factorial
Write a Java program that computes N! where N is a positive integer.
Hint:
public static long factorial(int n)
Lab Recursive Method
Write a recursive method to compute Fibonacci series.
Hint:
1.
fib(n)=fib(n-1)+fib(n-2)
2.
public static long fib(int n)
2008年12月12日 星期五
Lab Static Method
Define a Complex class with a static method for computing complex addition. Use (2+3i)+(4+5i) in your test.
2008年11月28日 星期五
Lab Java Constructor
Use Display 4.14 to call 4.13 (2nd ed.) or
Display 4.12 to call 4.11 (1st ed.).
After you finish the above, try the following
Date birthday = new Date("Jan",1,2000);
birthday.Date("Feb",1,2000);
birthday.setDate("Feb",1,2000);
birthday=new Date("Mar",1,2000);
Lab Overloading
Do Display 4.11
Lab ADT
Define a Complex class and write an object oriented program to compute (2+3i)+(4+5i) in Java.
The methods should include an access and a mutator.
較新的文章
較舊的文章
首頁
訂閱:
文章 (Atom)
連結
Java
最新回應
Loading...
網誌存檔
▼
2009
(1)
▼
1月
(1)
我有話要說
►
2008
(29)
►
12月
(4)
►
11月
(9)
►
10月
(8)
►
9月
(8)
標籤
心得
(1)
class
(18)
Homework
(5)