1. Complete Lab String Processing.
2. Write a program that can reverse the order of an input string. For example, if you input "ab", it will output "ba". If you input "abcdefg", it should return "gfedcba".
星期五, 9月 26, 2008
Lab: String Processing
Do Project 5 of Chap. 1 on Page 56.
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.
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.
Lab: Simple Arithmetics
Write a Java program that displays the results of the expressions 15/4, 4/15, 15%4, 4%15. Calculate the values of these expressions manually to verify that the displayed values are correct.
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.
星期五, 9月 19, 2008
Homework 9-19-2008
Due 9/26/2008 at 13:00
"tell me and I'll forget; show me and I may remember; involve me and I'll understand"
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
"tell me and I'll forget; show me and I may remember; involve me and I'll understand"
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 2: Java for Scientific Computation
Do Project 4 on Page 55. (3rd Edition)
Do Project 4 on Page 56. (2nd Edition)
Do Project 1 on Page 54. (1st Edition)
artificial sweetener 人工代糖(過量可以致癌)
diet soda pop 減肥可樂
lose weight 減肥
Do Project 4 on Page 56. (2nd Edition)
Do Project 1 on Page 54. (1st Edition)
artificial sweetener 人工代糖(過量可以致癌)
diet soda pop 減肥可樂
lose weight 減肥
星期四, 9月 11, 2008
Let's start blogging
1. 至 http://www.blogger.com 申請, 請以你的學號 (s開頭) 申請免費帳號。
2. 張貼你的部落格的第一篇文章。一小段歡迎詞,或是簡短自我介紹,或是你最喜歡的事物與最不喜歡的事物,都可以。
3. 建立一個連結到課程網站 http://javaatcycu.blogspot.com/
建議你使用右上角"自訂"功能,新增一個區塊。一個區塊內可以置放多個連結。
4. 日後請將你的隨堂練習與作業寫在你的 blog, 然後到
Homework 或 Lab 的Comment 登錄作業blog網址就可以了.
請勿將整個作業直接寫在老師部落格的Comment處。
5. 尊重智慧財產權,引用他人文章須註明出處。並且應該合乎學術常規,以合理的方式引用。
How to insert a link at the following comment, please use the following HTML code.
2. 張貼你的部落格的第一篇文章。一小段歡迎詞,或是簡短自我介紹,或是你最喜歡的事物與最不喜歡的事物,都可以。
3. 建立一個連結到課程網站 http://javaatcycu.blogspot.com/
建議你使用右上角"自訂"功能,新增一個區塊。一個區塊內可以置放多個連結。
4. 日後請將你的隨堂練習與作業寫在你的 blog, 然後到
Homework 或 Lab 的Comment 登錄作業blog網址就可以了.
請勿將整個作業直接寫在老師部落格的Comment處。
5. 尊重智慧財產權,引用他人文章須註明出處。並且應該合乎學術常規,以合理的方式引用。
注意事項
a. blog需正確設定時區顯示時間 。
b. 請測試他人可否留言(comment)。以方便留下回應意見。
How to insert a link at the following comment, please use the following HTML code.
訂閱:
文章 (Atom)