Study Display 3.1. Based on the income tax rate in Taiwan,
calculate the income tax of a person whose annual income
income is 1,000,000
income is 2,000,000
2008年3月24日 星期一
2008年3月23日 星期日
Homework 3-17-2008
※Project 1 of Chap. 2.
The Babylonian algorithm to compute the square root of a number n is as follows:
1.Make a guess at the answer(you can pick n/2 as your initial guess)
2.Compute r=n/guess
3.Set guess=(guess+r)/2
4.Go back to step 2 for as many iterations asnecessary.The more you repeat step 2
and 3,the closer guess will become to the square root of n.
※Project 3 of Chap. 2.
Write a program that reads in two integers typed on the keyboard and outputs their
sum,difference,and product it.
The Babylonian algorithm to compute the square root of a number n is as follows:
1.Make a guess at the answer(you can pick n/2 as your initial guess)
2.Compute r=n/guess
3.Set guess=(guess+r)/2
4.Go back to step 2 for as many iterations asnecessary.The more you repeat step 2
and 3,the closer guess will become to the square root of n.
※Project 3 of Chap. 2.
Write a program that reads in two integers typed on the keyboard and outputs their
sum,difference,and product it.
2008年3月22日 星期六
Lab Keyboard 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
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
2008年3月17日 星期一
2008年3月16日 星期日
Homework 3-10-2008: String Processing
Write a program that starts with a line of text and then outputs that line of text with the first occurrence of "hate" changed to "love". For example, a possible sample output might be
The line of text to be changed is:
I hate you.
I have rephrased that line to read:
I love you.
Hint: You may consider use the methods: indexOf(A_String) and substring(Start, End) in your program.
The line of text to be changed is:
I hate you.
I have rephrased that line to read:
I love you.
Hint: You may consider use the methods: indexOf(A_String) and substring(Start, End) in your program.
2008年3月10日 星期一
Lab: Simple Calculation
Suppose you are a landscape architect who charges $5,000 per mile to landscape a highway, and suppose you know the length in feet of the high way you are working on. Write a Java program to calculate the price you charge when the length is 6000 and 4000, respectively.
Hint: There are 5280 feet in a mile
Hint: There are 5280 feet in a mile
Homework 3-3-2008
1. Explain bytecode, JVM
ByteCode 是給予 JVM 執行的一種虛擬機器碼,也就是給於 JVM 的指令‧反過來說,JVM 就是 ByteCode 的解譯程式‧extends 的原始程式碼 (.java) 經由編譯後產生的類別檔 (.class) 就是 ByteCode 檔案‧
雖然 JVM 可能因平台而異,但是所有的 JVM 都能執行 extends 的 ByteCode‧
A Java Virtual Machine (JVM) is a set of computer software programs and data structures which use a virtual machine model for the execution of other computer programs and scripts
参考資料
Wikipedia
JDictionary
2. Explain class, object
class 可以是人,魚,汽車。人又可以分成很多種,例如:我的名字是dennis,他是Mary。我比較高,短頭髮,會打排球羽球。Mary比較矮,長頭髮,會談鋼琴,會游泳。我和Mary有同樣的class卻有不一樣的特性,就是object。此外,彈鋼琴、打籃球等動作可被視為個別物件的(methods)。
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;
ByteCode 是給予 JVM 執行的一種虛擬機器碼,也就是給於 JVM 的指令‧反過來說,JVM 就是 ByteCode 的解譯程式‧extends 的原始程式碼 (.java) 經由編譯後產生的類別檔 (.class) 就是 ByteCode 檔案‧
雖然 JVM 可能因平台而異,但是所有的 JVM 都能執行 extends 的 ByteCode‧
A Java Virtual Machine (JVM) is a set of computer software programs and data structures which use a virtual machine model for the execution of other computer programs and scripts
参考資料
Wikipedia
JDictionary
2. Explain class, object
class 可以是人,魚,汽車。人又可以分成很多種,例如:我的名字是dennis,他是Mary。我比較高,短頭髮,會打排球羽球。Mary比較矮,長頭髮,會談鋼琴,會游泳。我和Mary有同樣的class卻有不一樣的特性,就是object。此外,彈鋼琴、打籃球等動作可被視為個別物件的(methods)。
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;
2008年3月3日 星期一
Lab 2 Java for Scientific Computation
2008年3月1日 星期六
Homework 2-25-2008
1. Watch The Inside Story (Video), write your words on the development and inventor of Java
2. List at least 5 applications of Java. You must provide the references you used. We recommend Google Search engine.
手機上的Java Games,健保卡,加拿大的停車費繳費系統,eBay,網路銀行、旅遊網站、簡訊發送、衛星導航、物流倉儲等等
1.Bluetooth Bicycle Computer
2.V-Girl
3.Slooh
Java 憑籍多用途、高效率、平台可攜性及安全性,成為網路運算的理想技術,成為當今 25 億台以上的裝置背後的動力來源:
7 億多台電腦 ,7 億 8 百萬支行動電話及其他手持裝置 (來源:Ovum) ,10 億張智慧卡 ,加上視訊轉換盒、印表機、網路攝影機、遊戲、汽車導航系統、樂透終端設備、醫療裝置、停車收費器等。
現在,您可以在各種網路與裝置中發現 Java 技術,從網際網路與科學用超級電腦,到膝上型電腦與行動電話,從華爾街市場模擬器到家用遊戲機與信用卡 -- 幾乎無處不在。
參考資料:Java Everywhere,java
2. List at least 5 applications of Java. You must provide the references you used. We recommend Google Search engine.
手機上的Java Games,健保卡,加拿大的停車費繳費系統,eBay,網路銀行、旅遊網站、簡訊發送、衛星導航、物流倉儲等等
1.Bluetooth Bicycle Computer
2.V-Girl
3.Slooh
Java 憑籍多用途、高效率、平台可攜性及安全性,成為網路運算的理想技術,成為當今 25 億台以上的裝置背後的動力來源:
7 億多台電腦 ,7 億 8 百萬支行動電話及其他手持裝置 (來源:Ovum) ,10 億張智慧卡 ,加上視訊轉換盒、印表機、網路攝影機、遊戲、汽車導航系統、樂透終端設備、醫療裝置、停車收費器等。
現在,您可以在各種網路與裝置中發現 Java 技術,從網際網路與科學用超級電腦,到膝上型電腦與行動電話,從華爾街市場模擬器到家用遊戲機與信用卡 -- 幾乎無處不在。
參考資料:Java Everywhere,java
訂閱:
文章 (Atom)