2007年10月26日 星期五

import java.util.Scanner;
public class averageIncome
{
public static void main(String[] args)
{
int i,average;
System.out.println("請輸入總人數");
Scanner keyboard = new Scanner(System.in);
int number = keyboard.nextInt();
System.out.println("請輸入性別與收入");
int[] genderAndIncome = new int[number];
for()
}

}

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.

2007年10月25日 星期四

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.

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月12日 星期五

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.

所得1000000

所得:2000000

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?
ans:在C語言中使用縮寫的原因是因為要節省記憶體的損耗,不過那是在之前記憶體很昂貴時,才需要這麼做。將變數已完整的名稱命名可以讓使用者更容易看懂你所編寫的程式,這是不使用縮寫的好處,壞處就是會佔更多的資源,不過這應該無傷大雅。

10-5-2007 Homework

Project 1 of Chap. 2.
n = 10000

Project 3 of Chap. 2.

2007年10月5日 星期五

Lab: Keyborad Input

Lab: Scanner


執行程式後,在顯示結果的位置輸入數字

Lab: Adding Links on Your Blog