<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">

<channel>
	<title>好好學習．天天向上</title>
	
	<link>http://cccomp.sytes.net</link>
	<description>嶺南大學社區學院 資訊科技、數學及科學組</description>
	<pubDate>Thu, 20 Nov 2008 07:45:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/cccomp" type="application/rss+xml" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">1059200</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://www.feedburner.com</feedburner:feedburnerHostname><item>
		<title>ISM001 Class Summary (11)</title>
		<link>http://cccomp.sytes.net/2008/11/20/ism001-class-summary-11/</link>
		<comments>http://cccomp.sytes.net/2008/11/20/ism001-class-summary-11/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 04:36:58 +0000</pubDate>
		<dc:creator>張真人</dc:creator>
		
		<category><![CDATA[Class summary]]></category>

		<category><![CDATA[ISM001]]></category>

		<guid isPermaLink="false">http://cccomp.sytes.net/2007/12/03/ism001-class-summary-10/</guid>
		<description><![CDATA[Dear ISM001 students,
Chapter 13 is about exception handling. &#8220;Exception&#8221; means a problem that occurs infrequently during the program execution, or in other words, error. (But &#8220;error&#8221; has another meaning in Java, so we stick to the term &#8220;exception&#8221; here.)
In short, exception handling means handling the possible problems that arise during the program execution. Examples of [...]]]></description>
			<content:encoded><![CDATA[<p>Dear ISM001 students,</p>
<p>Chapter 13 is about exception handling. &#8220;Exception&#8221; means a problem that occurs infrequently during the program execution, or in other words, error. (But &#8220;error&#8221; has another meaning in Java, so we stick to the term &#8220;exception&#8221; here.)</p>
<p>In short, exception handling means handling the possible problems that arise during the program execution. Examples of these exceptions include the ArithematicException and the InputMismatchException. Fig. 13.3 of the text book shows some of the exceptions in Java.</p>
<p>We use <strong>try </strong>blocks to enclose code that may throw an exception, and <strong>catch </strong>blocks to deal with exceptions that may arise. We also use the <strong>finally </strong>block to release resources whether or not an exception occurs.</p>
<p>Moreover, we could use the <strong>throws </strong>clause to specify that a method may throw a certain exception, and the <strong>throw </strong>clause (note: no &#8220;s&#8221; here) to explicitly throw an exception in the program code. These are helpful in writing customized code for exception handling.</p>
<p>Why do we use the <strong>try-catch-finally</strong> structure to handle exceptions? Because it helps to separate the problem-handling code from the main line of the program execution. This brings us a better program structure for debugging and code reuse.</p>
<p>Next week we will move to the last chapter in this course, and then next next week it&#8217;s your turn to show your masterpiece (project) to the rest of the class.</p>
<p class="akst_link"><a href="http://cccomp.sytes.net/?p=279&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_279" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://cccomp.sytes.net/2008/11/20/ism001-class-summary-11/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Extra consultation hours for ISM001</title>
		<link>http://cccomp.sytes.net/2008/11/17/extra-consultation-hours-for-ism001/</link>
		<comments>http://cccomp.sytes.net/2008/11/17/extra-consultation-hours-for-ism001/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 02:52:07 +0000</pubDate>
		<dc:creator>張真人</dc:creator>
		
		<category><![CDATA[ISM001]]></category>

		<guid isPermaLink="false">http://cccomp.sytes.net/?p=708</guid>
		<description><![CDATA[Dear students of ISM001,
Please note the following Extra Consultation Hours exclusive for ISM001:

09:30-12:30, 8 Dec 2008 - 11 Dec 2008 @ NAB-309

If you are coming, please make revision first and try the exercises in the textbook. Thank you.
# Note: I will not be available in the morning and afternoon of  15 Dec 2008 (i.e. the [...]]]></description>
			<content:encoded><![CDATA[<p>Dear students of ISM001,</p>
<p>Please note the following <strong>Extra Consultation Hours</strong> <span style="text-decoration: underline;">exclusive for ISM001</span>:</p>
<ul>
<li><strong><span style="color: #ff0000;">09:30-12:30, 8 Dec 2008 - 11 Dec 2008 @ NAB-309</span></strong></li>
</ul>
<p>If you are coming, please make revision first and try the exercises in the textbook. Thank you.</p>
<p><em># Note: I will not be available in the morning and afternoon of  15 Dec 2008 (i.e. the few hours before the ISM001 exam). Please come to ask for help in the previous week. Thank you.</em></p>
<p class="akst_link"><a href="http://cccomp.sytes.net/?p=708&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_708" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://cccomp.sytes.net/2008/11/17/extra-consultation-hours-for-ism001/feed/</wfw:commentRss>
		</item>
		<item>
		<title>BUSA01 數學救亡班特別安排</title>
		<link>http://cccomp.sytes.net/2008/11/17/busa01-extra-consultation/</link>
		<comments>http://cccomp.sytes.net/2008/11/17/busa01-extra-consultation/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 02:29:58 +0000</pubDate>
		<dc:creator>張真人</dc:creator>
		
		<category><![CDATA[BUSA01]]></category>

		<guid isPermaLink="false">http://cccomp.sytes.net/?p=705</guid>
		<description><![CDATA[各位 BUSA01 同學：
請留意 12 月份的數學救亡班，將有以下特別安排：

12 月 3 日（星期三）早上的數學救亡班，將改為下午 15:30-17:30 於 NAB-206 舉行。
由 12 月 9 日至 12 月 11 日（星期二至星期四），張真人加開三節數學救亡班，每節兩小時。時間為 14:00-16:00，地點為 NAB-113。

Share This
]]></description>
			<content:encoded><![CDATA[<p>各位 BUSA01 同學：</p>
<p>請留意 12 月份的數學救亡班，將有以下特別安排：</p>
<ul>
<li>12 月 3 日（星期三）早上的數學救亡班，將改為下午 15:30-17:30 於 NAB-206 舉行。</li>
<li>由 12 月 9 日至 12 月 11 日（星期二至星期四），張真人加開三節數學救亡班，每節兩小時。時間為 14:00-16:00，地點為 NAB-113。</li>
</ul>
<p class="akst_link"><a href="http://cccomp.sytes.net/?p=705&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_705" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://cccomp.sytes.net/2008/11/17/busa01-extra-consultation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ISM001 Class Summary (10)</title>
		<link>http://cccomp.sytes.net/2008/11/13/ism001-class-summary-10-2/</link>
		<comments>http://cccomp.sytes.net/2008/11/13/ism001-class-summary-10-2/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 05:19:52 +0000</pubDate>
		<dc:creator>張真人</dc:creator>
		
		<category><![CDATA[Class summary]]></category>

		<category><![CDATA[ISM001]]></category>

		<guid isPermaLink="false">http://cccomp.sytes.net/2007/11/26/ism001-class-summary-9/</guid>
		<description><![CDATA[Dear ISM001 students,
Chapter 10 is about polymorphism, which is another important concept associated with OOP.
Today I delivered the concept of polymorphism using my own set of example programs. The programs served to demonstrate the following:
Dynamic binding
When we call the method displayMessage() of a Student object, Java actually knows that we want to call the method [...]]]></description>
			<content:encoded><![CDATA[<p>Dear ISM001 students,</p>
<p>Chapter 10 is about polymorphism, which is another important concept associated with OOP.</p>
<p>Today I delivered the concept of polymorphism using my own set of example programs. The programs served to demonstrate the following:</p>
<p><strong>Dynamic binding</strong></p>
<p>When we call the method <span style="color: #009900;">displayMessage()</span> of a <span style="color: #009900;">Student <span style="color: #000000;">object, </span></span>Java actually knows that we want to call the method of the corresponding subclasses. In other words, when a superclass variable contains a reference to a subclass object, and that reference is used to call a method, the correct subclass version of the method is called, and the programmer does not need to care about all these. This is known as <span style="color: #ff0000;"><strong>dynamic binding</strong></span> or <span style="color: #ff0000;"><strong>late binding</strong></span> (See p.487 of textbook) because the binding (determining which method to call) is done at run time.</p>
<p><strong>Abstract classes and methods</strong></p>
<p>We also looked at <span style="color: #ff0000;"><span style="font-weight: bold;">abstract </span></span>class and methods. An abstract class provides an appropriate superclass from which other classes can inherit and thus share a common design. For example, in the classes <span style="color: #009900;">ABSstudent </span>and <span style="color: #009900;">PADstudent </span>inherited from <span style="color: #009900;">Student</span>, we define the <span style="color: #009900;">displayMessage()</span> method in <span style="color: #009900;">Student</span> to restrict that <span style="color: #009900;">ABSstudent </span>and <span style="color: #009900;">PADstudent </span>must use <span style="color: #009900;">displayMessage()</span> (and not printMessage() or any other name) to display the message. Since <span style="color: #009900;">Student </span>does not know what major the student is in, we cannot write any code in the <span style="color: #009900;">displayMessage()</span> of <span style="color: #009900;">Student</span>, and so we must leave it abstract. We add the keyword abstract in front of <span style="color: #009900;">displayMessage()</span> to make it an abstract method. We also add the keyword abstract in front of the class name because any class with one abstract method must be declared abstract as well.</p>
<p><strong>Interface</strong></p>
<p>Finally, we looked at the concept of <span style="font-weight: bold; color: #ff0000;">interface</span>.  An interface is like an abstract class with <span style="font-style: italic;">all </span>the methods declared abstract. This is good if we want to share common design among unrelated classes. Any class that implements an interface must either define all the methods in the interface, or be declared abstract itself (in which case the implementation will be done by its subclasses).</p>
<p>Interfaces are different from abstract classes in many ways. For example, interfaces are used in place of abstract classes when there is no default implementation to inherit. Also, a class can inherit from only one superclass, but it may implement more than one interfaces. More information can be found in the textbook.</p>
<p>Next time we will move on to Chapter 13. It is about error handling in Java, which would be simple to understand. In contrast, in the next next class we deal with Chapter 16. It is about sorting and searching, which is difficult. So, make sure that you finish your revision as soon as possible.</p>
<p class="akst_link"><a href="http://cccomp.sytes.net/?p=273&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_273" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://cccomp.sytes.net/2008/11/13/ism001-class-summary-10-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ISM001: Suggested answer for JavaCity</title>
		<link>http://cccomp.sytes.net/2008/11/12/ism001-suggested-answer-for-javacity/</link>
		<comments>http://cccomp.sytes.net/2008/11/12/ism001-suggested-answer-for-javacity/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 09:07:21 +0000</pubDate>
		<dc:creator>張真人</dc:creator>
		
		<category><![CDATA[ISM001]]></category>

		<guid isPermaLink="false">http://cccomp.sytes.net/?p=686</guid>
		<description><![CDATA[Please read the suggested answer from the following:
http://phgod.pastebin.ca/1254164
Reference: ISM001: The Java City
Share This
]]></description>
			<content:encoded><![CDATA[<p>Please read the suggested answer from the following:</p>
<p><a href="http://phgod.pastebin.ca/1254164">http://phgod.pastebin.ca/1254164</a></p>
<p><strong>Reference: </strong><a rel="bookmark" href="../../2008/09/20/ism001-java-city/">ISM001: The Java City</a></p>
<p class="akst_link"><a href="http://cccomp.sytes.net/?p=686&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_686" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://cccomp.sytes.net/2008/11/12/ism001-suggested-answer-for-javacity/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ISM001 marking scheme for mid-term test</title>
		<link>http://cccomp.sytes.net/2008/11/12/ism001-marking-scheme-for-mid-term-test/</link>
		<comments>http://cccomp.sytes.net/2008/11/12/ism001-marking-scheme-for-mid-term-test/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 09:00:53 +0000</pubDate>
		<dc:creator>張真人</dc:creator>
		
		<category><![CDATA[ISM001]]></category>

		<guid isPermaLink="false">http://cccomp.sytes.net/?p=684</guid>
		<description><![CDATA[Dear ISM001 students,
Since no one is likely to take the make-up test anymore, I&#8217;m going to return the test papers to you in this week&#8217;s class. Please review all the questions (re-do if necessary) and refer to the marking scheme for the answers.
Share This
]]></description>
			<content:encoded><![CDATA[<p>Dear ISM001 students,</p>
<p>Since no one is likely to take the make-up test anymore, I&#8217;m going to return the test papers to you in this week&#8217;s class. Please review all the questions (re-do if necessary) and refer to the <a href="/ISM-001/ISM001-test-ans-2008-09.pdf">marking scheme</a> for the answers.</p>
<p class="akst_link"><a href="http://cccomp.sytes.net/?p=684&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_684" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://cccomp.sytes.net/2008/11/12/ism001-marking-scheme-for-mid-term-test/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ISM001 Class Summary (9)</title>
		<link>http://cccomp.sytes.net/2008/11/06/ism001-class-summary-9-2/</link>
		<comments>http://cccomp.sytes.net/2008/11/06/ism001-class-summary-9-2/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 07:47:23 +0000</pubDate>
		<dc:creator>張真人</dc:creator>
		
		<category><![CDATA[Class summary]]></category>

		<guid isPermaLink="false">http://cccomp.sytes.net/?p=674</guid>
		<description><![CDATA[Dear ISM001 students,
Chapter 9 is conceptual. Instead of learning the syntax of Java, we focus on one conceptual aspect of OOP &#8212; inheritance (is-a relationship) in Java. Why inheritance? One reason is code reuse. I gave an example in class using Player and BossPlayer to demonstrate the idea. A few main points are listed below [...]]]></description>
			<content:encoded><![CDATA[<p>Dear ISM001 students,</p>
<p>Chapter 9 is conceptual. Instead of learning the syntax of Java, we focus on one conceptual aspect of OOP &#8212; <a href="http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29"><strong>inheritance</strong></a> (<strong>is-a</strong> relationship) in Java. Why inheritance? One reason is code reuse. I gave an example in class using <span style="color: #339966;">Player </span>and <span style="color: #339966;">BossPlayer </span>to demonstrate the idea. A few main points are listed below to recap your memory:</p>
<ol>
<li>The use of the keyword <span style="color: #009900;">protected</span>, and why we should use it with great care.</li>
<li>The notions <strong>superclass</strong> and <strong>subclass</strong>. (Do not just memorize these. Try to give other examples in which inheritance can help.)</li>
<li>Declaring inheritance relationship by the keyword <span style="color: #009900;">extends</span>.</li>
<li>Calling the constructor of the superclass using <span style="color: #009900;">super</span>, or the methods of the superclass using <span style="color: #009900;">super.</span><span style="color: #009900;"><em>methodName</em></span><span style="color: #009900;">(&#8230;)</span>.</li>
<li>The <span style="color: #009900;">Object</span> class from which every other class directly or indirectly inherits.</li>
</ol>
<p>While this summary is a short one, it does not mean that Chapter 9 is easy or unimportant. In fact, Chapter 9 is short but difficult, and Chapter 10 would be long and difficult. Therefore,  please do the exercise problems in Chapter 9 to make sure that you can follow. Next time we would move on to Chapter 10 to talk about polymorphism in Java.</p>
<p class="akst_link"><a href="http://cccomp.sytes.net/?p=674&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_674" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://cccomp.sytes.net/2008/11/06/ism001-class-summary-9-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ISM001: Trade or War!</title>
		<link>http://cccomp.sytes.net/2008/11/01/ism001-trade-or-war/</link>
		<comments>http://cccomp.sytes.net/2008/11/01/ism001-trade-or-war/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 07:17:15 +0000</pubDate>
		<dc:creator>張真人</dc:creator>
		
		<category><![CDATA[ISM001]]></category>

		<guid isPermaLink="false">http://cccomp.sytes.net/?p=665</guid>
		<description><![CDATA[Dear ISM001 students,
Here is Homework 2, an extension of the last homework. It is a difficult one because it is designed to help you prepare for the examination. Please follow the instructions and submit your work by 12 December 2008 (the Friday before final exam).
Those interested may also take a look at the works from [...]]]></description>
			<content:encoded><![CDATA[<p>Dear ISM001 students,</p>
<p>Here is Homework 2, an extension of the <a href="http://cccomp.sytes.net/2008/09/20/ism001-java-city/">last homework</a>. It is a difficult one because it is designed to help you prepare for the examination. Please <a href="http://docs.google.com/Doc?id=dgn28fpv_209ccc5zpf9">follow the instructions</a> and submit your work by <strong>12 December 2008</strong> (the Friday before final exam).</p>
<p>Those interested may also take a look at the works from last year: <a href="http://citportfolio.blogspot.com/2007/10/text-fighter.html">Text Fighter</a> (homework 1), <a href="http://citportfolio.blogspot.com/2007/12/fighters-universe.html">The Fighters&#8217; Universe</a> (homework 2).</p>
<p>Some example outputs:</p>
<p><span style="font-family: Courier New; color: #0b5394;">*** Welcome to Trade or War! ***</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">=== Round 1 ===</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">City Thebes (500, 500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">City Corinth (500, 500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">BigCity Sparta (2000, 2000)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">BigCity Athens (2000, 2000)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: BigCity Sparta is in war with BigCity Athens!</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Sparta (800, 0)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Athens (1600, 3000)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">Your turn (0:Quit)(1:Trade)(2:War) &#8211;&gt; 1</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: BigCity Athens trades with BigCity Sparta. Both become more wealthy.</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Athens (1700, 3500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Sparta (900, 500)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">=== Round 2 ===</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">City Thebes (500, 500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">City Corinth (500, 500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">BigCity Sparta (900, 500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">BigCity Athens (1700, 3500)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: There is an earthquake in City Thebes!</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; City Thebes (100, -500)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: City Corinth trades with BigCity Athens. Both become more wealthy.</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; City Corinth (600, 1000)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Athens (1800, 4000)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">Your turn (0:Quit)(1:Trade)(2:War) &#8211;&gt; 2</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: BigCity Athens is in war with City Corinth!</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Athens (1440, 5000)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; City Corinth (240, -1000)</span><br style="font-family: Courier New; color: #0b5394;" /> <span id="more-665"></span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">=== Round 3 ===</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">City Thebes (100, -500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">City Corinth (240, -1000)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">BigCity Sparta (900, 500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">BigCity Athens (1440, 5000)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: City Corinth trades with BigCity Sparta. Both become more wealthy.</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; City Corinth (340, -500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Sparta (1000, 1000)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: BigCity Sparta is in war with City Corinth!</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Sparta (800, 2000)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; City Corinth (136, -2500)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">Your turn (0:Quit)(1:Trade)(2:War) &#8211;&gt; 3</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">!!! Wrong input !!!</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">Your turn (0:Quit)(1:Trade)(2:War) &#8211;&gt; a</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">!!! Wrong input !!!</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">Your turn (0:Quit)(1:Trade)(2:War) &#8211;&gt; 2</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: BigCity Athens is in war with BigCity Sparta!</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Athens (1152, 6000)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Sparta (320, 0)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">=== Round 4 ===</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">City Thebes (100, -500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">City Corinth (136, -2500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">BigCity Sparta (320, 0)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">BigCity Athens (1152, 6000)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: There is an earthquake in City Thebes!</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; City Thebes (20, -1500)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: BigCity Sparta trades with BigCity Athens. Both become more wealthy.</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Sparta (420, 500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Athens (1252, 6500)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: There is an earthquake in BigCity Sparta!</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Sparta (84, -500)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">Your turn (0:Quit)(1:Trade)(2:War) &#8211;&gt; 2</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: BigCity Athens is in war with City Thebes!</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Athens (501, 4500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; City Thebes (16, -500)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">=== Round 5 ===</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">City Thebes (16, -500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">City Corinth (136, -2500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">BigCity Sparta (84, -500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">BigCity Athens (501, 4500)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: BigCity Sparta is in war with City Corinth!</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Sparta (34, -2500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; City Corinth (109, -1500)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">Your turn (0:Quit)(1:Trade)(2:War) &#8211;&gt; 2</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: BigCity Athens is in war with BigCity Sparta!</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Athens (401, 5500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Sparta (14, -4500)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">=== Round 6 ===</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">City Thebes (16, -500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">City Corinth (109, -1500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">BigCity Sparta (14, -4500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">BigCity Athens (401, 5500)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: BigCity Sparta is in war with City Corinth!</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Sparta (12, -3500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; City Corinth (44, -3500)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">Your turn (0:Quit)(1:Trade)(2:War) &#8211;&gt; 2</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: BigCity Athens is in war with BigCity Sparta!</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Athens (321, 6500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">&#8211;&gt; BigCity Sparta (5, -5500)</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">*** News: There is no more citizen in BigCity Sparta! Game over.</span><br style="font-family: Courier New; color: #0b5394;" /> <br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">=== Game Statistics ===</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">City Thebes (16, -500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">City Corinth (44, -3500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">BigCity Sparta (5, -5500)</span><br style="font-family: Courier New; color: #0b5394;" /> <span style="font-family: Courier New; color: #0b5394;">BigCity Athens (321, 6500)</span></p>
<p class="akst_link"><a href="http://cccomp.sytes.net/?p=665&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_665" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://cccomp.sytes.net/2008/11/01/ism001-trade-or-war/feed/</wfw:commentRss>
		</item>
		<item>
		<title>BUSA01 Project Presentation Schedule</title>
		<link>http://cccomp.sytes.net/2008/10/30/busa01-project-presentation-schedule/</link>
		<comments>http://cccomp.sytes.net/2008/10/30/busa01-project-presentation-schedule/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 10:34:01 +0000</pubDate>
		<dc:creator>張真人</dc:creator>
		
		<category><![CDATA[BUSA01]]></category>

		<guid isPermaLink="false">http://cccomp.sytes.net/?p=658</guid>
		<description><![CDATA[For students from Sections 1, 2, 3, 4:
http://spreadsheets.google.com/pub?key=pphZ19OUg832mijAbsOKTWA
Share This
]]></description>
			<content:encoded><![CDATA[<p>For students from Sections 1, 2, 3, 4:</p>
<p><a href="http://spreadsheets.google.com/pub?key=pphZ19OUg832mijAbsOKTWA">http://spreadsheets.google.com/pub?key=pphZ19OUg832mijAbsOKTWA</a></p>
<p class="akst_link"><a href="http://cccomp.sytes.net/?p=658&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_658" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://cccomp.sytes.net/2008/10/30/busa01-project-presentation-schedule/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ISM001 Class Summary (8)</title>
		<link>http://cccomp.sytes.net/2008/10/30/ism001-class-summary-8/</link>
		<comments>http://cccomp.sytes.net/2008/10/30/ism001-class-summary-8/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 05:00:40 +0000</pubDate>
		<dc:creator>張真人</dc:creator>
		
		<category><![CDATA[Class summary]]></category>

		<category><![CDATA[ISM001]]></category>

		<guid isPermaLink="false">http://cccomp.sytes.net/2007/11/12/ism001-class-summary-8/</guid>
		<description><![CDATA[Dear ISM001 students,
Today&#8217;s class is a &#8220;turning point&#8221; in the course, meaning that if you do not work hard then there is no way to turn back and pass this course, because we will enter the advanced level of Java programming starting from Chapter 8.
To start with, I spent half of the class demonstrating how [...]]]></description>
			<content:encoded><![CDATA[<p>Dear ISM001 students,</p>
<p><strong><span style="color: #ff0000;">Today&#8217;s class is a &#8220;turning point&#8221; in the course, meaning that if you do not work hard then there is <span style="text-decoration: underline;">no way to turn back and pass this course</span>, because we will enter the advanced level of Java programming starting from Chapter 8.</span></strong></p>
<p>To start with, I spent half of the class demonstrating how to write a <span style="color: #339966;">TimeConfig</span> class that sets and displays time in various formats. I then went through the examples of Chapter 8 one by one, emphasizing the following key points:</p>
<ol>
<li>The <strong>Time1</strong> class in Fig. 8.1 was just another example of how to design and build a class. In particular, I re-emphasized the use of <strong><em>set</em></strong><strong>- and </strong><strong><em>get</em></strong><strong>-methods</strong> to modify and display the instance variables of the class.</li>
<li>Other techniques included the use of the <span style="color: #33cc00;"><strong>this</strong></span> reference to refer to the current object&#8217;s members (Section 8.4), and the overloading of constructors (Section 8.5).</li>
<li>I mentioned the <strong>Garbage Collector (GC)</strong> in Java, which is a facility to release unused memories automatically. The garbage collector attempts to reclaim memory no longer used by the objects of the Java program.</li>
<li>I also told you about the old days without automatic garbage collection. In C/C++, for example, it is the  programmers&#8217; responsibility to release the memory manually, or otherwise it may cause a  <a href="http://en.wikipedia.org/wiki/Memory_leak">memory leak</a>, which explains why some computer programs hang after running for a long time. Due to GC in Java, a Java programmer usually does not need to care about  garbage collection. In Fig. 8.13, we looked at how to manipulate with the GC in Java.</li>
<li>One shortcoming of the use of GC is that, even if we invoke the GC by <span style="color: #009900;">System.gc()</span>, it is not guaranteed when the GC will collect the garbage. For this reason, people doing scientific computation (e.g. me) would prefer C/C++ to Java when the program is computationally expensive (i.e. something that requires gigabytes of RAM and weeks of running time).</li>
<li>One more point to note about this example is the use of <span style="color: #009900;">static</span> class members in the counting of Employee objects. The Math class is another well-known example that uses static class members.</li>
<li>The keyword <span style="color: #009900;">static</span> can also be used with <span style="color: #009900;">import</span>. In Fig. 8.14, we used <span style="color: #009900;">import static java.lang.Math.*;</span> so as to call the sqrt method by <span style="color: #009900;">sqrt(900.0)</span> instead of <span style="color: #009900;">Math.sqrt(900.0)</span>. Note however that this can sometimes make your program difficult to debug, so use with care.</li>
<li>A final point to note in Chapter 8 is that, to declare a constant in Java, we use the keyword <span style="color: #009900;">final</span> (instead of <span style="color: #009900;">const</span> in C/C++).</li>
</ol>
<p>Chapter 9 is about <a href="http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29"><strong>inheritance</strong></a> (<strong>is-a</strong> relationship) in Java, which will be <em>very difficult</em>.</p>
<p>Another <span style="font-weight: bold; color: #ff0000;">Bad news</span>: Homework 2 is on the way and would be released in the coming week (I&#8217;m drafting it in Google Docs). The homework would force you to review the second half of the course. Trust me, this will be good for your exam.</p>
<p class="akst_link"><a href="http://cccomp.sytes.net/?p=265&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_265" class="akst_share_link" rel="nofollow">Share This</a>
</p>]]></content:encoded>
			<wfw:commentRss>http://cccomp.sytes.net/2008/10/30/ism001-class-summary-8/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
