|
|
|
|
CSE 142 Homework #1
Due: Sunday, January 12, 2003 at 9:00 PM. No late assignments will be
accepted.
Directions: Please answer the following questions. Use full sentences
when answering questions that require explanations. Remember to acknowledge
any help you receive from individuals outside the course staff. These
questions are based on material from lecture and from Ch. 1 and Sec. 2.1-2.3
of Nino & Hosch, which you should have already read.
You answers should be formated using Microsoft Word or WordPad (.doc
file), Notepad or any plain text editor (.txt), or any other file format
that can be read by recent versions of Microsoft Word. When you are done,
use this turnin form to submit your assignment
over the web. If you make a mistake, you can resubmit your assignment
as often as needed. We will grade the last one that you hand in. Your
graded assignment will be returned to you via email.
Remember to get started right away. Don't wait until Sunday after dinner
to begin, or you are likely not to finish on time.
Grading Guidelines: Each question or part of a question is worth
2 points. To gain the full 2 points, your answer must have no significant
flaws, must be clear to the reader, and must be complete (but remember
that complete does not mean verbose - be concise and to the point). One
point will be awarded to answers that are partially correct, are somewhat
unclear, or are incomplete. You must show credible effort to gain at least
one point per question.
1. [Exercise 1.4 p. 23] Assume that you are going to cook chicken stew.
Determine the following:
a. algorithm;
b. the data description;
c. the data values;
d. the computation.
2. [Adapted from Exercise 1.6 p. 23] Discuss the differences between algorithms
such as the one you created for question 1a in which you are the
processor, and algorithms carried out by a machine.
3. [Adapted from Exercise 1.8 p. 23] Suppose you want to write a program
to play chess. What are some of the objects you might use to model the
game? Suggest at least two properties and two responsibilities that three
different objects might have.
4. [Exercise 2.3] Consider a composite value that represents a point in
the Euclidean plane. What are the components of such a value? What are
the types of the components?
5. [Adapted from Exercise 2.4 parts b,c,d,f] For each of the following
applications, suggest at least two objects that might be included in the
system design. Give one or two responsibilities that might be assigned
to each object.
b. A program modeling traffic flow on major thoroughfares in a city.
c. An inventory control system for a hardware store.
d. A program controlling a vending machine.
f. A program that translates English into French
6. [Question is worth a total of 2 points.] Assume a student is modeled
by the image in Figure 2.2 on page 32. Assume the following queries and
commands are done sequentially (use result of part a
as the object for part b and so on). Give either the response to the query
or show the current state of the object. (You do not need to create a
drawing like Fig. 2.2 to show the state of the object. Just list the properties
and their current values.) Course fees are not
affected by the total number of credits for which the student is enrolled.
Either the student has paid the course fees or has not paid the course
fees.
a. Query for social security number.
b. Student adds course "Spanish 2005" worth 5 credit hours.
c. Query for credit hours.
d. Student drops course "Ethics 1001" worth 3 credit hours.
e. Query for course schedule.
f. Query for address.
g. Student pays course fees.
h. Student adds course "English Composition 1321" worth 4 credit hours.
i. Query for fees paid.
j. Query for credit hours.
7. This question is not intended to test your programming ability. We
want to be sure you have downloaded the software for the course and can
use it without problems, if you are working at home, or that you can use
the software in the IPL or other campus labs if you are working there.
Instructions for downloading and installing the course software can be
found on the Computing at Home
page on the CSE142 web. You need to install the Sun Java SDK, DrJava,
and the UW CSE software libraries and folders. You do not need to install
BlueJ for now.
Start DrJava. If you have installed it on your own machine, follow the
instructions on the Computing at
Home page. If you are using the IPL or other UW public lab, select
Programs from the Start menu, find the CSE
items, and run DrJava from there. Once DrJava has started, type the following
commands in the interactions window, the bottom window of the
screen, right after the > symbol. Hit the Enter key after
typing each line.
import uwcse.graphics.*;
GWindow w = new GWindow();
w.add(new Rectangle());
w.add(new Oval());
After you have typed these commands, describe what you see on the screen
to answer this question (i.e, what color are the shapes in the drawing,
roughly where are they in the drawing window - center, lower-right, etc.).
Remember that the important thing is to get the software installed and
working, not just to get the "right" answer. Get things working
now so you won't be fighting the software mechanics later.
|
 |
Department of Computer Science & Engineering
University of Washington
Box 352350
Seattle, WA 98195-2350
[comments to cse142-webmaster]
|
|