星期五, 10月 26, 2007

Homework 10-26-2007

Lab Exponential Function

Lab average income by gender

Advance notice

Lab Exponential Function

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

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

11-9-2007 Quiz 2

Scope: Chap 3
Format: Open book. Pencil & Paper.
Running time: 30 min.

預告: 11/23 期中考週不上課。

作業遲交

電子四丙9326314簡康祐

星期五, 十月 26, 2007 1:10:00 下午


9326268 李致學

星期五, 十月 26, 2007 2:07:00 下午


電子三乙9426236林庭輝

星期五, 十月 26, 2007 2:08:00 下午

ASSETS 2007 心得見聞分享

參加ACM ASSETS 2007回應出奇的好

母音與音調的妙用

聽人的語文是聽障者的第二語言

ASSETS 2007 ㄧ位女士的話

ACM ASSETS 2007 後記

鳳凰城動物園遊記

11-2-2007

老師請公假到美國參加ACM Web Intelligence會議發表論文,暫停課程一次。

Average income by gender

Write a program to calculate average income by gender based on the following data, where F stands for female and M for male.

F 62,000
M 25,000
F 38,000
F 43,000
M 65,000
M 120,000
F 80,000
M 30,100

You should be able to allow users to type in a whole line such as F 80,000 followed by next line M 30,100.

Without any change made to your program, your program should be able to process a new set of data, such as follows:

M 52,000
M 35,000
F 48,000
M 33,000
F 75,000
F 110,000
F 90,000
M 30,100

Lab 9*9

Write a program to generate the following table of arithmetic expressions

1*1=1 1*2=2 1*3=3 ... 1*9=9
2*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 of
a 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....

Want to know more about Fibonacci number

星期五, 10月 12, 2007

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.

Lab Finding the max of three numbers

Write a program to decide the max number of the three input number.

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.

Quiz 10-12-2007 pass list

電子三丙9426364張家瑜
資管三甲 9444162 陳怡如
電子三乙 9426208 黃韋翔
電子三乙9426212黃嘉弘
電子三丙9426352陳彥儒
電子三甲 9426106 周家汝
電子四乙9326227彭書敏
電子三乙9426202蘇柏寬
電子三丙9426324詹敬翔
電子三乙 9426219 郭逸興

繳交時間超過15分鐘以上者
電子4 9326315梁彥
電子四乙 9326222 黃璽祐

未通過者下週前需補做Bonus

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?

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.

星期二, 10月 09, 2007

10月19日,停課一次。

10月19日,老師出國發表論文,停課一次。

星期五, 10月 05, 2007

10-5-2007 Homework

Lab: Keyboard Input
Project 1 of Chap. 2.
Project 3 of Chap. 2.

10-5-2007 點名未到

電子三乙 郭逸興
電子三乙 李文森
電子三丙 謝志揚
電子三丙 潘冠宇
電子三甲 鄭安舜
電子四乙 黃璽祐 (有請假單)
電子四乙 林士傑 (有請假單)
電子四甲 曾韋碩
醫工四甲 東峻平

下次務必帶課本

同桌兩人可共用一本,新版或舊版不拘,下次未帶者,將開始抵扣平常分數,每次十分至零分為止。

Lab: Keyborad Input

Rewrite Display 2.6 using BufferedReader.

You need to import the following packages in the first place.

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

Note the Main method needs IOException handling as follows:

public static void main (String[] args) throws IOException

Lab: Scanner

Do Display 2.6.

Lab: Adding Links on Your Blog

1. Check into your blog homepage.
2. Enter "自訂"
3. Select "連結清單"
4. Write down "http://javaatcycu.blogspot.com/" and the title as "Java物件導向程式設計"
5. Also add your own favorite links.

Programming Styles

Goal:
Make your code easy to read and easy to modify.

Spelling conventions
  • name the variables as the names suggest
  • Start the name of classes with uppercase letters (such as String, FirstProgram) and start the names of variables, objects, and methods with lowercase letters.
  • Word boundaries are indicated by an uppercase letter, as in numberOfPods
  • Java spells things out in full. Use BufferedReader instead of BufReader, BuffReader, BufferedR or BR. With abbreviations, we often cannot recall how the identifier is abbreviated.
Comments
  • "Just enough" is enough.
  • When something is important and not obvious, it merits a comment.
  • Example of unnecessary comment
interest = balance * rate; //Computes the interest.

Self-documenting
  • the structure of the program is clear from the choice of identifier names and indenting pattern.
Indenting
  • The general rule of indenting is easy. When one structure is nested inside another structure, the inside structure is indented one more level.
  • We prefer to use four spaces for each level of indenting. Indenting only two or three spaces is fine so long as you are consistent. One space is not enough to be clearly visible.

Oct-12-2007 Quiz of Chap. 1

Format: Open book, computer-based test
Running time: 30 min.
Scope: Chap. 1