This page describes how you can take CS 202 as a self-paced course.
There are four units:
Topic 1: The procedure-oriented features of Java
The Java syntax for assignment statements, declarations, if statements, loops, arrays, and so forth were taken from C, so you will see a lot of similarities between C and Java from this standpoint. Take a look at this table to see a comparison.
However, there are some basic, important differences. For example,
Pages 4-6 of the paperback ProgramLive Companion give the first two units of a course on programming using Java. This material, plus some additional material on types and programming style, will be covered in this first unit. You need to look at only enough to transfer your procedure-oriented programming skills in another language (probably C or C++) to Java.
Each item of a unit tells you what to listen to on the CD ProgramLive. It also points you to a page of the paperback Companion, where there are some simple questions to answer. We encourage you to write the answers in the paperback Companion itself as you listen to the activities on the CD, for two reasons. (1) Doing so will help you realize what you know and don't know, so that you can restudy what you don't know. (2) The simple act of writing an answer impressed it more firmly in your mind.
Below, we tell you what material of units 1 and 2 to cover. We don't list everything, because you know about programming already. Of course, you are free to look at more than what we describe below. Here's what to look at and why.
0. Introduction. Read the introductions to Units 1 and 2, to get a basic idea of what they cover.
1. How ProgramLive works. Do the items at the bottom of page 4, which deal with PL Lesson 0, which introduce you to the essential features of the CD ProgramLive.
2. Basic program structure. On page 5, do the item labeled "Some simple Java programs". This will introduce you to the basic structure of a Java program. Here's what you must come away with:
A program consists of a collection of classes, each of which can be viewed as a drawer of a filing cabinet. A class can be viewed simply as a container of things. One thing it contains is methods (functions and procedures) that are declared with modifier static. (We'll see much later what happens when this keyword is missing.) One class must contain a method main, which is called to begin execution of the program.3. Basic statements and types. On page 5:
(a) Glance cursorily at item "Components of a Java program".4. Iteration (loops). The C and Java while and for loops are exactly the same --same syntax, same execution. So, if you know about C loops, you don't need to study loops further. If you don't know about loops, you probably shouldn't be in this course. Turn to page 9 of the paperback ProgramLive Companion and do Unit 5.(b) Look seriously at item "Three statements".
(c) Look seriously at item "Conventions for indentation". We use indentation o help understand a program's structure and keep it manageable. If your programming assignment is not indented properly, the grader will give it back to you, without grading it, and ask you to fix it and come back again.
(d) On item Input/output, do all activities but the one labeled "Using the Java Console for Input". Most important is the first activity in writing on the Java console and the third activity on GUI JLiveWindow, which you will use for testing some programs.
(e) You are not required to do the Labs (listed on page 5), but you can if you wish.
(f) Do the item "Types". You should do more than Lesson pages 6-1 and 6-2; also look seriously at Lesson pages 6-3 (floating points), 6-5 (type char), and 6-6 (type boolean). C does not have a type boolean; instead 0 is used for true and anything non-0 is used for false. Do spend some time studying type boolean. Look especially at the last activity on Lesson page 6-3.
5. Arrays. Turn to page 11 of ProgramLive and do just the first item on arrays, "Introduction to arrays". This one Lesson page contains all the technical details you need to know about arrays.
6. Functions and procedures. These are called "methods" in Java. Turn to page 5 of the paperback ProgramLive Companion and do Unit 2. You can skip the parts on topdown programming, testing and debugging, testing strategies, and debugging, since you probably has this material when you studied programming.
Do study the conventions for naming parameters, local variables, etc; conventions for indentation; and guidelines for writing methods. There is some discussion of the fact that "array" is like a class; don't try to understand that part now. The important part for now (1) how one declares an array variable, (2) how one creates a new array and stores it in an array variable, (3) how one references the length of an array, and (4) how one references as array element.
Assignment for topic 1. Turn to Lesson 2 (Methods) on the ProgramLive CD, click the Project Icon (a hammer), and look at project PGL-1, "Project Dates". This is your assignment for topic 1.
This project is sometimes assigned before arrays and loops have been
introduced ---that's the reason for comments like "the body of this method
will probably contain 11-12 copies of repetitive code...". Feel free to
use loops and arrays where they will simplify your programming. You may
want to have a String array that contains the names of the months. You
can declare this as a "constant" array as follows:
String[] months= {"", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};Note that "" is given as the first entry so that "January" is in months[1].
You will have to make simple uses of Strings. All you need to know is the following:
A significant part of this assignment is that you get your development
environment in order. Please actually code and test this assignment.
We now begin an exploration of the object-oriented features of Java. You know already that every program consists of (at least one) class, which contains at least a static method main. You know also that one can define (declare) any number of static methods and variables in a class.
Turn to page 7 of the paperback ProgramLive Companion and do Unit 3, all of it. You don't have to hand in the three Labs that are mentioned in this unit, but for your own benefit, we urge you to do them.
Assignment for topic 2. This
assignment has to do with writing some classes for dealing with combination
locks.
Topic 3: Subclasses and inheritance
Only with subclasses and inheritance does the full power of object-oriented programming become available, as you will see when studying this topic.
Turn to page 8 of the paperback ProgramLive Companion and do Unit 4, all of it. You don't have to hand in the three Labs five labs that are mentioned in this unit, but for you own benefit, we urge you to do them. The order of priority for these labs is:
Assignment for topic 3.
This assignment has to do with
interpreting a small machine language.
Topic 4. Miscellaneous points.
You now know the basics of object-oriented design using Java. We turn to a few miscellaneous points about Java. The first one, applets, is usually covered briefly in CS100; the others are not, and they will not be used on the assignment for this topic.
1. Applets. Turn to page 13 of the paperback ProgramLive Companion. Do everything required in Unit 11 on applets.
2. Exception handling. Turn to page 12 of the paperback ProgramLive Companion. Do as much as you want in Unit 8. It will help you understand error messages and give you a better feel for Java if you have studied this material.
3. Interfaces. The interface provides an alternative to subclasses, in a way. Turn to page 12 of the paperback ProgramLive Companion and do all of Unit 9.
4. Arrays. Now that you know about classes, you can appreciate that "int[]" --i.e. a one-dimensional array of ints-- is a kind of class. It will help your understanding to turn to page 11 of the paperback ProgramLive Companion and do the first two items in Unit 6 on arrays.
5. Threads.
Assignment for topic 4. This assignment will extend assignment 3 using exceptions and threads.
Last Modified: Tuesday, September 04, 2001 06:00:59 PM