Introduction to Computer Programming (CS 1302) - Fall 2013


    Instructor: Yang, QingXiong (qiyang at; Office: Academic Building 1, Y6638, close to lift 4)
    Tutorial Assistant 1: LEUNG, Ho Yin (, Wednesday 11:00 - 11:50)
    Tutorial Assistant 2: SHEK, Tsz Lung (, Tuesday 17:00 - 17:50)


1: Final Exam in May 12, 2-4pm, LT-3, closed-book.

Key Info.

    Lecture:Wednesday 9:00 - 10:50 at AC1 G5-317
    Tutorial 1:Wednesday 11:00 - 11:50 at AC2 5503
    Tutorial 2:Tuesday 17:00 - 17:50 at AC2 5503
    Office Hours: Wednesday 14:00 - 17:00 in my office (AC1 Y6638).
    Random Student Picker: link

Online Resources

Online Tutorials

    HTML Tutorial:
    JavaScript Tutorial:

Programming environment/Debugging

    SharePoint Designer 2007:
    Visual Studio 2008:
    Debugging Script:


    HOT Questions:

Class Schedule (subject to change)

    DataTopicReading/Lecture NotesLecture Exercise Exercise Solutions
    Week 1
    Introduction to Computer & Programming Slides:
    Course Info.,
    Overview of JavaScript
    Source Code: Code Samples
    (NULL) (NULL)
    Week 2
    Program Structure I Slides: 2ProgramStructureI.pdf,
    Source Code: Code Samples
    Questions: LectEx02.pdf Solutions:
    Source Code: Given Code
    Week 3
    Questions: LectEx03.pdf Solutions:
    Given Code.
    Week 4 (NULL) (NULL)
    Week 5 Program Structure II Slides: Lec04_ProgramStructureII.pdf,
    Source Code: Code Samples
    Week 6 Quiz 1. Analysis on Quiz 1 (NULL) (NULL)
    Week 7 Program Structure III Slides: 4ProgramStructureIII, 4ProgramStructureIII-cont
    Source Code: Code Samples
    Week 8 Program Structure IV Slides: ProgramStructureIV
    Source Code: Code Samples
    (NULL) NULL.
    Week 9 JavaScript Global Functions and Objects I Slides: FuncObjI.pdf
    Source Code: Code Samples
    Questions: LectEx08.pdf Solutions:
    1. LectEx08_solution.pdf,
    2. Q1: FloatingPoint.
    Week 10
    Week 11 JavaScript Global Functions and Objects II Slides: FuncObjII.pdf
    Source Code: Code Samples
    Questions: LectEx11.pdf Solutions:
    Week 12 Questions: LectEx12.pdf Solutions:
    Week 13 (NULL) (NULL)


    Tutorial No.Tutorial Tasks Tutorial Solutions
    1: FTP server Start Project 1: a personal website. (Due: Week 13, Sunday 23:59)
    Guidelines for setting up personal homepage:
    1) Video; 2) PDF; 3) Example (right click on the link and choose save as); 4) Password problem
    2: from HTML to Javascript Tasks: PDF
    Supplementary material: Tut02.html, CS1301.gif
    Solution to:
    Task 1, 2, 3
    3: innerHTML ⋅ parseInt ⋅ summation (+) and -, *, / create a form with textbox, functions Tasks: PDF
    Result: Video.
    Supplementary material: Tut02_MarkCalc.html,
    Solution to:
    Task 1
    Task 1, 2
    4: innerHTML, pseudo-URL, function, parseInt, numbers and arithmetic operators Tasks: PDF
    Supplementary material:
    5-6: Equality Operator (= =), Assignment Operator (=), AND (&), Global variable, if .. else statement, return statement, true/false Tasks: PDF
    Supplementary material:
    Template, tic-tac-toe (wiki explanation), Winning Strategies, Quiz 1.
    7: Use of random numbers, Color codes, onkeyup and onload events Tasks: Tut07.pdf
    Supplementary material: Tut07_GuessBlue.html
    Solution to:
    Task 1, Task 2
    8: Change image source, setInterval Tasks: Clock Animation.pdf
    Supplementary material:
    Task 1
         a) Template: Tut07_Task1.html
         b) Images:
    Task 2
         a) Template: Tut07_Task2.html
         b) Images:
    Images for Optional Task
        Additional pictures for 60
    Solution to:
    1. Required Task 1,
    2. Required Task 2,
    3. Optional Task 1,
    4. Optional Task 2
    9: Repetition structure (while loop and for loop) Tasks: Picture_Gallery.pdf
    Supplementary material:
    1. Template to start with
    2. images
    Solution to:
    1. Required Task,
    2. Optional Task 1.
    10: Random number generation, Math object methods, dynamic movement of HTML elements Tasks: Tut09.pdf
    Supplementary material:
    1. Template and images
    Solution to:
    1. Required Task,
    2. Optional Task,
    11: Using the Date object Tasks: Tut10.pdf
    Supplementary material:
    1. Tut10_template.htm
    Solution to:
    1. Task 1,
    2. Task 2.
    12: Using the Date object 2 Tasks: Readme

Two Quizzes (in the lecture)

    Quiz 1 (Week 6, Feb. 26, about 30 minutes, in the lecture)
    Quiz 2 (Week 13, about 50 minutes, in the lecture)

Four Projects

    Project 1: Personal Website Project 2: Gambling Game (Step 1)
    (Due: Week 14, Wednesday (April. 23), 23:59)(Due: Week 7, Sunday, March. 9, 23:59)
    Project 3: Gambling Game (Final Step)
    (Due: Week 12, Sunday, April 13, 23:59)

    Project 4: How old are you?
    (Due: Week 13, Sunday, April 20, 23:59)

University requirement on academic honesty

Violations of academic honesty are regarded as serious offences in the University. Acts such as plagiarism and fabrication of research findings can lead to disciplinary action. Most commonly the penalty is failure in a course, but in the most serious cases expulsion from the University and debarment from re-admission may occur.