好好學習.天天向上

嶺南大學社區學院 資訊科技、數學及科學組

Archive for September, 2007

ISM001: Simple Text Fighter

with 3 comments

Dear ISM001 students,

Homework 1 has been released. This homework covers Chapters 2 to 5 of your textbook. Please follow the instructions and submit your work by 18 October 2007.

Some example outputs:

Java Simple Text Fighter! v20070928

== Round 1 ==
Player Ho Yin’s power = 100
Player Justin’s power = 100
Justin attacks Ho Yin!
Justin wins
== Round 2 ==
Player Ho Yin’s power = 99
Player Justin’s power = 101
Justin attacks Ho Yin!
Justin wins
== Round 3 ==
Player Ho Yin’s power = 97
Player Justin’s power = 103
Justin attacks Ho Yin!
Justin loses

Written by 張真人

September 29th, 2007 at 12:50 pm

Posted in ISM001

BUSA01 Sec 4 中秋節如常上課

without comments

9 月 25 日中秋節 13:30 至 15:00 的 BUSA01 Sec 4 將如常上課,請同學依時出席。

Written by 張真人

September 25th, 2007 at 12:54 am

Posted in BUSA01, 公佈

數學救亡班 2007

without comments

各位 BUSA01 的同學:

「數學救亡班」是供 BUSA01 副學士先修班同學自由參與的額外數學課,由任教 BUSA01 的導師主持,目的是幫助對數學缺乏信心的同學,追上正規課堂進度。按慣例,「救亡班」於每年的十月開始每週舉行,直至上學期完結為止。

由張真人主持的本學期第一次「數學救亡班」,定於十月第一個星期舉行,歡迎所有 BUSA01 同學參加。暫定詳情如下:

  • 第一班:Mondays, 09:30-10:30(十月八日 至 學期完結)
  • 第二班:Wednesdays, 11:30-12:30 (十月三日 至 學期完結)

地點為 NAB-113 (General Science Laboratory),屆時請帶備教科書、草稿紙及文具。

註:「救亡班」時間跟部份諮詢時段 (consultation hours) 重疊。各 ISM001 的副學士同學,請盡量利用其它諮詢時段,或另外跟我預約其他時間。多謝合作。

Written by 張真人

September 24th, 2007 at 5:15 pm

Posted in BUSA01

ISM001 Class Summary (3)

without comments

Our third class saw some difficulty as some students got screwed up with the OOP stuff. In addition to the points mentioned in the last class summary, let me further clarify a little bit:

  1. The use of setCourseName and getCourseName as the names of the methods is a convention rather than a rule of Java. For example, you can use abc in place of setCourseName and xyz in place of getCourseName. The javac compiler would not complain provided that the naming is consistent throughout your program. However, the convention makes it easier for programmers to understand what the methods are about, and therefore it is recommended as a good programming practice.
  2. It is also a convention to use lowercase for the first letter of the method name, and capital letter to indicate the starting point of a new word (see Good Programming Practice 2.12 in your textbook). Therefore, the method that “sets the course name” is named as setCourseName. The same convention applies to the naming of variables, and that is why “course name” is named as courseName.
  3. A similar convention applies to the naming of the class, except that we always start the class name with an uppercase letter, such as GradeBook.

As always, students are recommended to read the textbook, then break the programs by changing some of the names and see what happens.

Below list a few other key points in the third class:

  1. We mentioned the use of constructors to initialize an object. Students should compare the constructor in Fig. 3.10 with the setCourseName method.
  2. I emphasized the initialization of instance variables in a Java class. Although all primitive types are initialized with a default value in Java, this is not always the case in other programming languages. It is a good practice to initialize the instance values by yourself. For example, use private double balance = 0.0; in line 7 of Fig. 3.13.
  3. Students should break the program in the following way: In Fig. 3.11, change line 11 to GradeBook gradeBook1 = new GradeBook(); (i.e. remove the string between the brackets) and see what happens. Why didn’t we have this problem in the previous examples?
  4. We learned about floating points numbers and the type double in Section 3.8. Pay attention to how we initialize the Account objects in lines 10 and 11 of Fig. 3.14. Also note the use of an if-statement in line 14 of Fig. 3.13.
  5. How do we specify the number of decimal places displayed in the printf method?
  6. For Chapter 4, I intensionally skipped Sections 4.1 to 4.7 in the class because these cannot be well understood without trying a few programs on your own. In Section 4.8, I showed you how to use a while-loop to repeatedly ask the user for inputs. I also emphasized the importance of the statement gradeCounter = gradeCounter + 1; (line 57, Fig. 4.6) to increment the counter in each loop. Apart from the fun with the infinite loop by commenting out this statement, students should remember the missing of this statement as a frequently seen error among junior programmers.
  7. As a final remark, I emphasized the problem of getting only the integer part of the answer if you divide an integer by another integer in Java (see line 61, Fig. 4.6). This is called integer division and is seen also in C/C++. Line 72 of Fig. 4.9 tells you how to fix the problem.

Please read Sections 3.7, 3.8, 4.1 to 4.8 and try the exercise problems before the next class. We are moving into the more advanced topics of the course and it is important for students to gain enough programming and debugging experience before moving on.

Powered by ScribeFire.

Written by 張真人

September 24th, 2007 at 10:02 am

Posted in Class summary, ISM001

ISM001: Hints to some of the project topics

without comments

Dear Programmers of ISM001,

For those of you who have started to work on the project, I’ve added some additional information to Topic 3: Fractal Generator and Topic 7: Exciting Java Games.

For Topic 3, I’ve added two Java applets that I wrote in summer 2005 to demonstrate how to draw the b/w and colored Mandelbrot set respectively. The source code of the b/w one is given, while that of the colored one is left to the students as an exercise. Remember that I only count on the code that you add into the source.

For Topic 7, I’ve added a link to a tutorial about how to write a Space Invaders game in Java. The complete source code is given and so you can download the source code to run it on your computer. This tutorial is very good in a sense that it demonstrates a lot of techniques that you would need to write a game such as 嶺南齊打交 or 逃出嶺南, as some of you suggested.

Reference: ISM001 Project Guideline

Written by 張真人

September 21st, 2007 at 10:41 pm

Posted in ISM001

網上驚現思想黑客

with one comment

初次玩這個 Mind Reader 的把戲,有一種思想被人「黑」(cracked) 了的感覺。今年在 BUSA01 班中扮演「騙徒」和「受害人」的同學,感受應該更加深刻。

「它是怎樣知道的呢?」這是我即時的疑問。事隔數年,那瞬間的心靈激動,至今仍然深刻。其實若是冷靜下來仔細思考,要識破箇中玄機亦非難事。

你又能道破箇中玄機嗎?你會怎樣分析呢?

The Flash Mind Reader:

mind-reader

(本篇乃重貼去年的 BUSA01 教材)

Written by 張真人

September 21st, 2007 at 4:00 pm

Posted in BUSA01, 數學

ISM001: Bad news of the month

without comments

The mid-term test of ISM001 is scheduled at 15:30-17:30, Friday 26 October 2007 at NAB-206. The class in the morning would be canceled. Please make your revision and ask questions as soon as possible.

Reference: Test and Examination Information

Written by 張真人

September 21st, 2007 at 12:56 pm

Posted in ISM001, 公佈

Information Talk of BSc(IM) programme in HKU

without comments

CIT Year 2 students (and others who take ISM003) may be interested in the following message from HKU:

The University of Hong Kong (HKU) will hold its Information Day for Undergraduate Admissions 2007 on October 27 and 28, 2007. It aims to introduce the University’s activities, programmes and facilities to the public.

The Faculty of Education offers a full-time Bachelor of Science in Information Management programme for candidates holding a recognized Higher Diploma, Professional Diploma or Associate Degree in any discipline. There will be an exhibition of the programme on G/F and 1/F of Rayson Huang building, HKU during the Information Day.

Our Programme Director, Dr Sam Chu will deliver an information talk at 1:45pm on October 27, 2007 in Room 205, Runme Shaw Building. All potential candidates are welcome to attend the talk.

Written by 張真人

September 19th, 2007 at 3:45 pm

Posted in CIT

BUSA01: Bad news of the month

with one comment

各班 BUSA01 同學:

本學期第一次測驗 (Test 1),暫定於以下時間及地點進行:

  • 日期:10 月 12 日(星期五)
  • 時間: 16:40-17:20 (請提早 10 分鐘到達,逾時不候)
  • 地點:NAB-319

請帶備學生証及文具(鉛筆或鉛芯筆、擦膠等),詳情可參閱 Test and Examination Information

參考:BUSA01 Bad News of the Month

如因事未能出席,請盡快跟導師聯絡。

Written by 張真人

September 19th, 2007 at 12:15 pm

Posted in BUSA01, 公佈

Mukden Incident 1931

without comments

Mukden_1931_japan_shenyang

今天是九一八事變七十六週年。九一八事變(又稱瀋陽事變;日本稱滿洲事變,因中國東北舊稱滿洲)是指1931年9月18日在中國東北爆發的一次軍事衝突和政治事件。衝突雙方是中國東北軍和日本關東軍。 — 維基百科

Powered by ScribeFire.

Written by 張真人

September 18th, 2007 at 9:19 am

Posted in 歷史

Close
E-mail It