星期一, 12月 25, 2006

Lab Sorting

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

星期一, 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);
}
}

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.

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.

星期二, 12月 12, 2006

隨堂上機考 (2) Pass

9226310
9326214
9326264
9328344
9326349
9326359

星期一, 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

隨堂上機考 (2)

Write a program to implement a method that can do additions of 2 fractions. You will implement a class called Fraction consisting of a numerator and a denominator. The additions of
2 fractions should be equal to a fraction.
Use 1/2+1/3 as the test.

Hints:
Fraction f1, f2;
f1.add(f2);

隨堂上機考 (1)


Define a class called Counter whose objects count things. An object of this class records a count that is a nonnegative integer. Include methods to set the counter to 0, to increase the count by 1, and to decrease the count by 1. Include an accessor method that returns the current count value and a method that outputs the count to the screen. Write a program to test

counter.reset();
counter.inc();
counter.inc();
counter.dec();
counter.output();

星期五, 12月 08, 2006

12-11-2006 隨堂上機考

範圍:課本第四章
題目:隨堂公告
方式: Open Book

星期一, 12月 04, 2006

大三專題說明


張耀仁老師
專題題目
說明會:
1/3/2007

1/19/2007

老師會談時間
  • 建議先 email 與我約時間 (yjchang at cycu.edu.tw)

Lab Temperature Project

Do Temperature Project, which is Project 7 (2nd ed.) or Project 3 (1st ed.).

Homework 12-4-2006

1. Do Java Overloading
2. Do Temperature Project.

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);