2007年10月27日 星期六

Lab 9*9

Write a program to generate the following table of arithmetic expressions1*1=1 1*2=2 1*3=3 ... 1*9=92*1=2 2*2=4 2*3=6 ... 2*9=19...9*1=9 9*2=18 9*3=27 ... 9*9=81

Lab Fibonacci numbers

Do Project 3.3 (1st ed.) or Project 6 (2nd ed. & 3rd ed.) Fibonacci numbers.List the first 100 numbers and the ratio ofa number to its previous number, such as 1/1 = 1, 2/1 = 2, 3/2 = 1·5, 5/3 = 1·666..., 8/5 = 1·6, 13/8 = 1·625, 21/13 = 1·61538....

2007年10月25日 星期四

Homework 10-12-2007: 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.

2007年10月18日 星期四

Bonus: Lab for-loop

Write a program to generate the series 1, 1, 2, 3, 5, 8, 13, ...The series has a property that the third number is the sum of the first and second numbers. For example, 2=1+1, 3=1+2, and 5=2+3.

2007年10月12日 星期五

Lab Finding the max of three numbers

Write a program to decide the max number of the three input 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 or 2,000,000.

2007年10月11日 星期四

Quiz 10-12-2007

1. Let i, j be two integers. Write a program to exchange their values. How can you show your program is correct.















2. The identifier BufferedReader is normally abbreviated as BR in programming language C. However, Java programmers normally do not use abbreviations for identifiers. What are the advantages and disadvantages of not using abbreviations?
由於以前記憶体昂貴,為了節省記憶體,所以縮寫;現在記憶體便宜多了,所以比較不需要;沒縮寫可以讓表達的意思比較清楚;至於縮寫是有節省空間的好處

Project 3 of Chap. 2.


Project 1 of Chap. 2.


2007年9月27日 星期四

Homework 9/21/2007

1. Explain bytecode, JVM
bytecode
The Java compiler translates your Java program into a language called bytecode,which isthe machine language for a fictitious computer.It is easy to translate this bytecode into the machine language of any particular computer.Each type of computer will have its own interpreter that translates and executes bytecode instructions.
JVM
The Java Virtual Machine is very similar to all typical computers.Thus,it iseasy to translate a program written in bytecode into a program in the machine laguage for any particular computer.
2.Explain class, object
Class
物件導向設計中,物件並不是憑空產生的,你必須先定義你的物件,你要ㄧ個規格書,這個規格書稱之為類別(Class)
Object
object(物件):將一組彼此相關的「程序」(Procedure)和「資料」(Data),由軟體程式碼將他們封裝起來這些程序為物件之「方法」(Method);資料則為「成員變數」(Field)「物件」是「類別的實例(an instace of a 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;

















4.2 Write a Java program as follows:
Let i=2;
Print i;
Print 2 * (++i);
Print i;






















4.3 Write a Java program as follows:
Let m=7, n=2;
Print (double) m/n;
Print m/ (double)n;

2007年9月21日 星期五

2007年9月15日 星期六

大家好

大家好 我是林士傑 叫我小華也可以 歡迎來到我的部落格