COMP 112: Introduction to Programming, Fall '09

This is an introduction to programming using  the Java programming language, a so-called object-oriented, imperative programming language. No background in computing is assumed.

What's New

  •   David White will be available in SC 74 from 7-10pm, Monday, to help with homework.
  • HW 4
  • Correct code for isLeapYear
  • Some slides covering material from week 10 lectures.

  • Some additional programs from week10 and week 11.
  • Solutions to selected problems from Midterm I

  • Some notes/programs from past and upcoming lectures in weeks 7-9
  • Some notes/programs from weeks 4 and 5 lectures

  • Solutions to selected problems from Homework 0
  • Solutions to selected problems from Homework 1

  • Click on fetch: to get a free FTP client for Macintosh
    Make sure you click on the option: "apply for an educational or charitable license", and then you get it with no time limit for free. To get there click on "buy/upgrade" on the home page. When you use fetch you must choose to connect (to rintintin) via sftp (and not just ftp).

    Coming soon: same info for PC owners once I find a free one that works!

  • The code (and some remarks) from week 3 lectures
  • Some questions sent to me by students, along with answers are listed in the following FAQ web page
  • A crash course on UNIX


  • A 1-page outline of Java for novices

  • A 3 page quick reference to the Java Programming language. This was writen for accomplished programmers, so it's a bit advanced now, but will become handy later in the course.
  • Some examples from week 2 lectures:
  • wk 2
  • Not so new

  • Updated Homework 3 file, with new instructions.

    Additional note: IN HW 3, please call the third file Prime.java instead of prime.java. Make the appropriate change to the name of the class, too.


  • Homework 2 is available.
  • A review sheet for Midterm I
  • UPDATED!!! to include instructions on how to mail it in , and some new instructions for problem 5 (how to wrap it): Updated Homework 2

  • Some solutions to the Midterm I review sheet problems

  • Updated web page for HW 1.

  • Homework 0 has been updated to include specifics about how to name and mail your files, and some further description of the programs required. Note that the due date is Monday, Sept. 28, at 11:59 PM.
  • PC users: Here you can find clear instructions on how to set up Java (the so-called JDK) on your PC, running XP or Vista. It turns out you have to change TWO environment variables to get javac to run anywhere. Read the web page. It makes this very clear.

  • On using Cygwin-X on your PC: (windows Vista).


  • New and improved! (with graphics examples)
  • Purchase:
    Cay Horstmann's BIG JAVA, 3rd edition, Wiley, 2008, ISBN ISBN: 978-0-470-10555-9 and read chapters 1 and 2.


  • Basic Information

  • Instructor's name: James Lipton
  • Instructor's Office: 635 Sc
  • Phone: 2188
  • Email: jlipton@wesleyan.edu

    for all course-related correspondence: subject heading MUST contain COMP 112

  • Email for homework: TBA
  • Office Hours: Mon. 10-11,12:30-2, and by appt.
  • Lectures Will be held in Sc 74
  • Lab Assistants

    • Graduate Teaching Assistant
    • David White
    • email: dwhite03@wes....
    • Office: Sc 630-B
    • lab assistants
    • Duc Phung email: dphung@wes...
    • Zachary Rebich email: zrebich@wes...

  • Class location and times: Sc 74,
  • Sec 1 8:30-9:50 Mon, Wed
  • Sec 2 11:00-12:20 Mon, Wed
  • Computing Facility

    The machine dedicated for use in this course is rintintin.wesleyan.edu on which you already have accounts.

    You will be shown how to log in next week.

    See the Other Resources section below for

  • Ways to use Wesleyan computing resources to program in Java, and
  • Ways to download the necessary software to program on your own machine.
  • The JAVA computing environment

    Writing and running Java programs involves the following steps
    1. Writing the text program in the Java language. (This program usually given a name of the form <program-name>.java) using your favorite program editor (i.e. a special-purpose word-processor)
    2. Compiling the program with javac. This transforms the original program to a new one, in so-called bytecode, stored in a file called <program-name>.class)
    3. Running the above-mentioned class file on the so-called "JVM", by issuing the command:
      java <program-name>.

    This means one needs 3 pieces of software to play this game:

    1. A program Editor
    2. the java compiler javac
    3. the JVM interpreter, called java
    In this course we will use emacs for (1), and, for (2) and (3) the javac compiler and java interpreter provided by the so-called SUN Java Development Kit (JDK), SUN being the company that invented JAVA.

    These three components are available on the PCs in SCI 74 (our lab) and almost all the PCs on the campus computing facilities. They are also available on rintintin.wesleyan.edu, a machine that can be accessed from (almost) any networked PC or MAC on Campus.

    They can also be downloaded for free onto your own computer. See Other Resources below.

    If you have a MAC with OSX then you already have everything you need! (this will be explained in class)


    Midterms



    Other Resources for this course

    a brief tour of Java by Gosling (the creator of Java) and McGilton
    To download the java and javac programs for your own use, (as well as a program editor)
    For a MAC running OSX
    You're in luck! You have almost everything you need. You need to know how to open a terminal window, and type javac or java when needed.

    As for a program editor, you already have a windowless version of emacs. However, this is not mouse-senstive and a pain to use. So you will want to download Aquamacs.

    You can also use another program editor for Java. Alpha Edit and BBedit work fine on Macs. (See me about this).

    For a PC running Windows

    (This is not trivial: roll your sleeves up)

    CLICK HERE.

    To SKIP all of this, and just connect to rintintin.wesleyan.edu

    From the Mac: (note changes!!)
    X11 is already installed on most Macs. look here for details

    On a PC (not too trivial, but not so bad)
    use your ssh program (if you don't have it or can't find it, this will be explained in lab) to connect to rintintin. You can still use emacs in "non-window" mode (by typing emacs -nw <filename>),

    OR

    download cygwin (read THIS WEBPAGE) and follow the same steps shown in lab! I'll show how to download cygwin in lab.

    On a linux machine
    Follow the same steps as on a MAC. If you lack javac or emacs, see me.
    Other web resources for JAVA

    Syllabus

    WeekDateTopicReading Homework Due Remarks
    1 S9 Introduction to the language and the Course Gosling et. al.Java summary Turn in student info sheet Mondays 7-11: evening slot for labs and review sessions
    2 S14-16 A tour of Java and imperative & object-oriented languages: Variables, parameters, classes, methods. Ch 1,2 (esp. 2.1-2.10) in BJ
    3 S21-23Basic Java: Using Objects and Classes.   Graphics Ch.2 (esp. 2.11-2.13 on Graphics) in BJ HW 0 due Sept. 28 at 11:59pm 2.11-2.13 Introduce graphics in Java
    3 Sept. 21 First Lab meeting Monday, 9:30 pm
    4 S28-30Basic Java: Building your own Classes. Ch.3 in BJ
    5 Oct. 5 Homework Help Session Monday, at 9:30pm, in Lab: Sc 74
    5 O5-7 Fundamental Data Types (4.1-4.4), Strings (4.6) and Taking input from user (4.7) Ch. 4 in BJ HW 1 Due Wed. Oct 7, 11:59 PM
    6 Oct 12-14more on Strings. (4.6). Control structures:if, switch and while Ch. 5 and Ch. 6.1 in BJ
    7 Oct 19-21More about Control: loops and iteration with while and for. Termination. REVIEW Ch. 6 in BJ HW 2 Due Wed. Oct 21, 11:59pm Mon. Oct. 19, 8-10pm: Help for HW2 in lab (Sc72)

    TUE. Oct 20, 6-8pm: Office hour, SC 635
    Oct 23-27 Fall Break
    8 Oct 28MIDTERM I in class
    9 Nov 2-4More Control: Iteration II. for loops. Nested loops. Arrays Rest of Ch.6. (up to 6.5) and 7.1 Prog. HW 3 Program due Fri. Nov. 6, 11:59pm
    10 Nov 9-11 Arrays and other Collection types Ch.7.2-7.3, 8.1
    11 Nov 16-18 Arrays and Lists. Graphics applications Ch. 7 Prog. HW 4 Due Tue., Nov. 24, 11:59pm
    12 Nov 23 Applications & REVIEW
    Nov 25-28 Thanksgiving Break
    13 Nov 30MIDTERM II in class
    13 Dec. 2 Principles and Theory of Class Design.
    14 Dec 7-9 Interfaces. Events ch. 9 in BJ Last week of classes.
    14 Dec.10-16 Office Hours. Consultations Final Projects Project DEMOS Must be Scheduled to take place on Dec. 13-16

    
       September 2009
    Su Mo Tu We Th Fr Sa
           -------------
    --------- 9 10 11 12
    13 14 15 16 17 18 19
    20 21 22 23 24 25 26
    27 28 29 30
    
        October 2009
    Su Mo Tu We Th Fr Sa
                 1  2  3
     4  5  6  7  8  9 10
    11 12 13 14 15 16 17
    18 19 20 21 22 -----
    ---------28 29 30 31
    
       November 2009
    Su Mo Tu We Th Fr Sa
     1  2  3  4  5  6  7
     8  9 10 11 12 13 14
    15 16 17 18 19 20 21
    22 23 24 -----------
    ---30
    
       December 2009
    Su Mo Tu We Th Fr Sa
           1  2  3  4  5
     6  7  8  9 10 -----                   ---- no class
    ------rrrrr eeeee rr                   r    reading period 
    rr eeeee 23 24 25 26                   e    exam period
    27 28 29 30 31
    
    
    	  
    Last modified: Sun Dec 24 13:06:10 EST 2006
    Last modified: Fri Nov 20 13:49:39 EST 2009