CS 161: Introduction to CS/OOP/Java
Winter 2001 -- Dr. Burnett
Homework/Workshop #1: Intro to Code Warrior and Java
Due: Wednesday, Jan. 17, 2:00 p.m.


How to turn it in: Follow the instructions for each problem, and turn in the files electronically as instructed on the web page



 
 

Problems 1-3 are workshop problems to get your lab skills ready for the upcoming first programming assignment.

1-3. [5 pts each] Do lab exercises 1-3, pp. 47-50, using Code Warrior.

For lab exercise 1, turn in the Java and HTMLfiles you constructed. It must compile successfully for full credit.  Names should be TimerApplet.java and TimerApplet.html (make sure to use the same class name as the file name).

For lab exercise 2, turn in the Java file containing one or more syntax errors (such as the ones given in the lab exercise, or some other syntax error). Since the Java file contains syntax errors, it must not compile successfully.  This file should be named TimerSyntaxErr.java (along with the class name).

For lab exercise 3, turn in the Java and HTML files you constructed with the third semantic error from the exercise in it. It must compile successfully for full credit (but since it contains a semantic error, we know it will not produce the correct output).  These files should be named TimerSemanticErr.java and TimerSemanticErr.html (don't forget about those class files!).



 
 

For the remaining problems, turn in a single text file (Homework1.txt) containing the answers to all the questions. For problems 4-6, if you explain your answer (i.e., give a whole sentence instead of just 1 phrase), it will be easier for us to give you partial credit.

4. [5 pts]

5. [5 pts] Suppose I built my own computer out of parts, and I have an operating system for it that runs fine (but I'm not going to tell you whether it is NT, Windows 2000, MacOS, Linux, or what). The operating system is the only software I have so far. 6. [5 pts] 7. [5 pts] Do exercise 5, p. 53.

8. [5 pts] Do exercise 18, p. 54, using pseudocode. Another way of expressing this problem is that you are to define Square objects that are able to tell you (take the responsibilities for computing) their areas and their circumferences.

Pseudocode is informal because it is a design tool, but it does need to be clear and unambiguous. Thus, your pseudocode should make clear where the class definition starts and ends, what the instance variables are, what the class's methods are, how each method performs its task, etc. Your pseudocode can look a lot like Java if you wish, but since it is pseudocode, it is not expected to actually compile or run.