
星期四, 12月 28, 2006
星期一, 12月 25, 2006
星期一, 12月 18, 2006
sample code of a class with static methods
public class RoundStuff
{
public static final double PI=3.14159;
public static double area(double radius)
{
return (PI*radius*radius);
}
public static double volume(double radius)
{
return((4.0/3.0)*PI*radius*radius*radius);
}
}
{
public static final double PI=3.14159;
public static double area(double radius)
{
return (PI*radius*radius);
}
public static double volume(double radius)
{
return((4.0/3.0)*PI*radius*radius*radius);
}
}
Lab Static Method, Part II
(1st ed.) Do Project 3 of Chap 5. Define a Complex class and write a program to compute (2+3i)+(4+5i) in Java.
(2nd ed.) Do Project 7 of Chap 5. Define a Complex class and write a program to compute (2+3i)+(4+5i) in Java.
Note:
Implement a static method and a nonstatic method using overloading. The results of these two methods should be the same.
(2nd ed.) Do Project 7 of Chap 5. Define a Complex class and write a program to compute (2+3i)+(4+5i) in Java.
Note:
Implement a static method and a nonstatic method using overloading. The results of these two methods should be the same.
Lab Static Method
Study Display 5.2.
Using static variables and static methods to implement the class Fibonacci such that
the first call to Fibonacci.next()
returns 2, the second returns 3, and then 5, and so on.
Using static variables and static methods to implement the class Fibonacci such that
the first call to Fibonacci.next()
returns 2, the second returns 3, and then 5, and so on.
星期二, 12月 12, 2006
星期一, 12月 11, 2006
隨堂上機考 (1) Pass
9226122,
9226133
9226143
9226144
9226251
9322326
9326101
9326107
9326119
9326151
9326205
9326243
9326252
9326253
9326254
9326258
9326264
9326319
9326324
9326330
9326344
9326346
9326349
9326359
9326363
9326366
9426344
9226133
9226143
9226144
9226251
9322326
9326101
9326107
9326119
9326151
9326205
9326243
9326252
9326253
9326254
9326258
9326264
9326319
9326324
9326330
9326344
9326346
9326349
9326359
9326363
9326366
9426344
訂閱:
文章 (Atom)