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

星期一, 11月 27, 2006

Java Overloading

Study Display 4.11 and use Display 4.12 to call 4.11. (2nd ed.)

Study Display 4.9 and use Display 4.10 to call 4.9 (1st ed.)

Lab Class Definitions III

Do Display 4.7 (2nd ed.) or 4.5 (1st ed.). Then use Display 4.8 to call 4.7.

Requirements
1. The method setDate has the parameter as setDate(int month, int day, int year).
What kind of changes should be made in its body of codes?

星期一, 11月 20, 2006

Lab Class Definitions II

Study Display 4.2 & Display 4.4 (2nd ed.) or Display 4.2 & Display 4.3 (1st ed.) and then
1. comment out date.setDate(6, 17, year); by // date.setDate(6, 17, year);
2. At the next line below, add date.readInput();
3. Run the program again. Fix any problems you may encouter along the way.
4. At the last line of your program, add System.out.println(date.month);
and see what happens. Why?

星期一, 11月 06, 2006

Lab Class Definition

Study Display 4.1 and then do Exercise 1.

Java 2

Java 2 分成 Java 2 Platform Enterprise Edition(簡稱 J2EE)、Java 2 Platform Standard Edition(簡稱 J2SE)、Java 2 Platform Micro Edition(簡稱 J2ME)。J2EE 適用於伺服器,目前已經成為企業運算、 電子商務等領域中相當熱門的技術;J2SE 適用於一般的電腦;J2ME 適用於消費性電子產品。

星期一, 10月 30, 2006

Homework 10-30-2006

1. Do Lab Exponential Function
2. List 5 examples of Fibonacci numbers in nature.

10/30號未帶課本者

9226363 徐欣隆 ,9326154 翁屴維 ,9326258 歐季佑 ,9326153 陳勝勇 ,9226143 許勝智 ,9226310 黃兆平

Lab Exponential Funtion

Do Project 7 of Chap. 3. (2nd ed.) or Project 4 (1st ed.)

Hint: You don't have to use nested loops.

Lab Fibonacci numbers

Do Project 3.3 Fibonacci numbers.
List the first 100 numbers and the ratio of
a number to its previous number.

Want to know more about Fibonacci number

星期一, 10月 23, 2006

Homework 10-23-2006 Finding the max and the min

Based on your study of Display 3.8, write a code to find the max and min of a list of number.
For example, given 1,3,5, and9, the max is 9 and the min is 1.
Your program should be able to process a list of any length.

Lab Tax Calculation

Study Display 3.1. Based on the income tax rate in Taiwan,
calculate the income tax of a person whose annual income is 1,000,000.

星期一, 10月 16, 2006

Homework 10/16/2006

Due 10/23/2006 18:50
1. Lab Scanner
2. Lab windon input dialog

Lab Scanner

Do Display 2.6 on Page 79.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

Change

Scanner keyboard= new Scanner(System.in);

into

BufferedReader keyboard= new BufferedReader(new InputStreamReader(System.in));

String inputString = keyboard.readLine();

Lab window input dialog

Use the following command to generate a window input dialog

String myString=JOptionPane.showInputDialog("Enter a number: ");

use the following command to convert a string to a number

int myNumber = Integer.parseInt(myString);

and finally use the following command to print the input number to the console

System.out.println("The number is "+ myNumber);

Don't forget the following import command

import javax.swing.JOptionPane;

so that Java can recognize JOptionPane library.

星期日, 10月 15, 2006

Lab Get Familiar with Java String

Display 1.7 of Chap. 1

Project 5 of Chap. 1

"tell me and I'll forget; show me and I may remember; involve me and I'll understand"

星期五, 10月 06, 2006

使用原版之教科書

由於(台灣國際圖書業交流協會書函), 叮嚀必須使用使用原版之教科書作為上課及教學之用, 所以本課程使用原版之教科書作為上課及教學, 凡是攜帶課本影印本者, 一律不准進入教室.

星期一, 10月 02, 2006

10-2-2006 未帶課本者

由於上課時上機的需要, 同學務必攜帶課本, 你可以向修過這門課的學長借, 無論是第一版或第二版都可以.

以下是本周上課未帶課本的名單, 本學期不可超過三次未帶.

星期六, 9月 30, 2006

有修Java的同學請注意一下

1.文章的出處請記得標明

2.請別直接複製別人的網頁 , 因為複製過多別人的網頁,

會被評為垃圾部落格 , 到時候就無法發表文章

3.電子四甲的鍾兆豐同學 , 你的部落格好像遺失 , 無法看到 , 請跟我回應一下 , 謝謝

星期一, 9月 25, 2006

作業批改原則

特別好的給予鼓勵, 特別水準不足的告知如何改正,
其餘將不加註意見.

Lab 10-2 (1) Simple Java Expression

Do Project 4 on Page 56. (2nd Edition)

Do Project 1 on Page 54. (1st Edition)

Homework 9-25-2006

"tell me and I'll forget; show me and I may remember; involve me and I'll understand"

Homework Problems due 10/2 18:50
1. Explain bytecode, JVM
2. Explain class, object
3. Reading Assignments:
Read 1.1, 1.2, 1.3 of Textbook

4.1 Write a Java program as follows:

Let i=2;
Print i;
Print 2 * (i++);
Print i;

Ans: 2, 4, 3

4.2 Write a Java program as follows:

Let i=2;
Print i;
Print 2 * (++i);
Print i;

Ans: 2, 6, 3

4.3 Write a Java program as follows:

Let m=7, n=2;
Print (double) m/n;
Print m/ (double)n;

Ans: 3.5, 3.5

Lab 9-25 (1) Get familiar with JBuilder

Do Display 1.1

星期一, 9月 18, 2006

Homework 1

1. List at least 5 features of the Java Language.
2. List at least 5 applications of Java. You must provide the references you used. We recommend Google Search engine.

Lab: Using Firefox

Outlines of Lab

1. download Firefox 1.5

2. control font size

3. tabbed browsing

4. subscribe to the course blog

5. Using bookmarks to test RSS feed

Help



Hands on

1. Easy control of font size (try ctrl+ & ctrl- as many times as you like)
2. tabbed browsing (try ctrlT)
3. RSS feed, and support of Blog. Use the RSS feed from http://iapblog.blogspot.com/
to subscribe to it. Also subscribe to your own blog.

Note:
If your Firefox didn't work, you should check settings about proxy. It should be set as proxy.cycu.edu.tw at port 3128.

星期四, 9月 14, 2006

Lab: Blogging

1. 至 http://www.blogger.com 申請, 請以你的學號 (s開頭) 申請免費帳號。主旨欄請用以下格式 "Java作業一" "Java Lab 1"
以加速助教登錄作業成績。

2. 請將你的作業寫在你的 blog, 然後到
Homework 或 Lab 的Comment 登錄作業blog網址就可以了.
請勿將作業直接寫在 comment

Blogging

Why Blog?

Things to learn with Blog


Rules of Blogging

Lab: Lab of blogging

2006 Fall Syllabus: Java

上課內容, 評分原則, 課本, 上機工具

上學期學生成績分布

同學對本課的評語

星期一, 6月 12, 2006

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 Recursive Method

Write a recursive method that computes the sum of squares from 1 to n, given an interger n.

星期一, 5月 29, 2006

Homework 5-29-2006 Lab Squared Numbers in an Array

Write a program that given an array of integers, return the squares of the array.
The sqaures are computed in a separate method rather than in the main method.


Cookie

Lab 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.
Cookie

星期一, 5月 15, 2006

Lab Sorting

Study Display 6.1, and then write a program that can sort 5 numbers in ascending order. The 5 numbers are input by the user.

星期一, 5月 08, 2006

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.

Homework 5-8-2005

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

星期一, 5月 01, 2006

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.

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

星期二, 4月 25, 2006

Homework 04-25-2006 (Java Overloading)

Study Display 4.11 and use Display 4.12 to call 4.11. (2nd ed.)

Study Display 4.9 and use Display 4.10 to call 4.9 (1st ed.)

星期一, 4月 10, 2006

Lab Class Definitions III

Do Display 4.7 (2nd ed.) or 4.5 (1st ed.). Then use Display 4.8 to call 4.7.

Requirements
1. The method setDate has the parameter as setDate(int month, int day, int year).
What kind of changes should be made in its body of codes?

Cookie

星期一, 3月 27, 2006

Lab Class Definitions II

Study Display 4.2 & Display 4.4 (2nd ed.) or Display 4.2 & Display 4.3 (1st ed.) and then
1. comment out date.setDate(6, 17, year); by // date.setDate(6, 17, year);
2. At the next line below, add date.readInput();
3. Run the program again. Fix any problems you may encouter along the way.
4. At the last line of your program, add System.out.println(date.month);
and see what happens. Why?

4/3 校外學習週停課一次, 4/17 期中考停課一次

Homework 3-27-2006 Lab Class Definitions

Study Display 4.1 and then do Exercise 1.

星期一, 3月 20, 2006

Lab Finding max from a list of numbers

Write a program that reads 10 numbers from the console.
Pick the largest bumber from the list.

Lab Exponential Funtion

Do Project 7 of Chap. 3. (2nd ed.) or Project 4 (1st ed.)

Hint: This lab gets you familiarized with nested for loops.

Homework 3-20-2006 Lab Fibonacci Numbers

Do Project 3.3 Fibonacci numbers.
List the first 100 numbers and the ratio of
a number to its previous number.

Want to know more about Fibonacci number

星期一, 3月 06, 2006

Lab Finding the max and the min

Based on your study of Display 3.8, write a code to find the max and min of a list of number.

Lab Tax Calculation

Study Display 3.1. Based on the income tax rate in Taiwan,
calculate the income tax of a person whose annual income is 1,000,000.

Lab Scanner

Do Display 2.6 on Page 79.

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

Change

Scanner keyboard= new Scanner(System.in);

into

BufferedReader keyboard= new BufferedReader(new InputStreamReader(System.in));

String inputString = keyboard.readLine();

星期一, 2月 27, 2006

2-27-2006 加分紀錄

9224205 工業三乙 江昇祐 上課回答問題, 平常分數加 5 分

Homework 03/06/2006 Lab JOptionPane (Chapter 2)

Use the following command to generate a window input dialog

String myString=JOptionPane.showInputDialog("Enter a number: ");

use the following command to convert a string to a number

int myNumber = Integer.parseInt(myString);

and finally use the following command to print the input number to the console

System.out.println("The number is "+ myNumber);

Don't forget the following import command

import javax.swing.JOptionPane;

so that Java can recognize JOptionPane library.

Lab Get Familiar with Java String

Display 1.7 of Chap. 1

Project 5 of Chap. 1

"tell me and I'll forget; show me and I may remember; involve me and I'll understand"

Homework 02/27/2006

Reading Assignments
1. Chapter 1

Homework
1. Project 1 on Page 55.

"nothing builds self-esteem and self-confidence like accomplishment"

星期一, 2月 20, 2006

Lab 2 Simple Java Expressions

Do Project 4 on Page 56.

2-20-2006 Homework

Homework Problems
1. Explain bytecode, JVM
2. Explain class, object
3. Let i=2;
Print i;
Print 2 * (i++);
Print i;

Ans: 2, 4, 3

4. Let i=2;
Print i;
Print 2 * (++i);
Print i;

Ans: 2, 6, 3

5. Let m=7, n=2;
Print (double) m/n;
Print m/ (double)n;

Ans: 3.5, 3.5

Reading Assignments
Read 1.1, 1.2, 1.3

Lab 1 Get familiar with JBuilder

Do Display 1.1

星期六, 1月 14, 2006

Lab: Using Firefox

1. download Firefox 1.5

2. control font size

3. tabbed browsing

4. subscribe to the course blog

5. Using bookmarks to test RSS feed

Help

Lab: Blogging

1. 至 http://www.blogger.com 申請, 請以你的學號 (s開頭) 申請免費帳號。主旨欄請用以下格式 "Java作業一" "Java Lab 1"
以加速助教登錄作業成績。

2. 請將你的作業寫在你的 blog, 然後到
Homework 或 Lab 的Comment 登錄作業blog網址就可以了.
請勿將作業直接寫在 comment

Using Blogs

Why Blog?

Things to learn with Blog


Rules of Blogging

Lab: Lab of blogging

Using Firefox

advantages of using Firefox

2006 Spring Syllabus: Java

上課內容, 評分原則, 課本, 上機工具

年輕真好

張老師隨筆全文