Assignments
- Presentations on Polymorphism in C++. See
The First Go-around
Purpose: review of polymorphism in C++.
- Video Game.
Purpose: an introductory analysis example.
- a) Describe a simple video game that you might be interested in
programming.
due: 3/28
via: hard copy or e-mail
- b) Read the OOA on the Bug squashing game from Cohoon and Davidson
and perform a similar analysis, as outlined on the hand-out, for your game.
due: 3/30
via: hardcopy
- c) Your design group should meet to pick a particular design project. If
it varies much from one of the previous problem descriptions write a new
problem description. Then review your design using CRC-cards.
For each of the classes in the project make up a CRC-card. The name of the
class should be at the top of the card and that of the group member (person)
responsible for
that class on the right top. Have a column labeled "Responsibilities" on the
left and one labeled "Collaborators" on the right. List the
responsibilities of the class and associated collaborating classes. On the
reverse of the card, write down the attributes of the class. Stay away from
any implementation decisions such as language, algorithms, data structures.
Try to keep it abstract; you need not take care of every detail. Cards need
not be provided for some small, "read-only", classes.
See CRC
cards
due: TBA
via: The group leader will collect the cards and give them and
the problem description to me.
Purpose: Designing, discovering classes and relationships - not
documenting or implementing.
- d) Let's wrap this up by Friday classtime at which time the description
and CRC-cards will be due. OK?
Turtle Derivation
Purpose:
- Review of DDU style
- Review of graphics you might need.
- To compare to the Java turtlegraphics in Slack.
Do the following:
- a) Consider my C++ snowflake.cpp program in Accounts/courses/cs257
as well as the use of turtlegraphics in Slack.
- b) Extract the turtle class from my program. You may make changes to
the turtle class if you care to or as the need arises. Put the class into a header
file, turtle.h, Or put the declarations in turtle.h and the
definitions in turtle.cpp.
- c) Derive another turtle class. The derived class should at least add some
new functionality, e.g. backward(int), penup(), pendown() and should
override some function in the base class, e.g. override
turnleft to do it the way it is in the book. You may add
other functions as well.
- d) Apply the turtle classes in some small program. Name it
testturtle.cpp
- References on g2 graphics:
due: 4/4 11:59 pm
via: hsp. See Homework Submission Program
Pop Quizzes/Labs
- Common C++ errors (see pqlab1.cpp)
- Constructors/Destructors (see array1.cpp)
- Accessibilty (Visibility)
- Virtual, static v. dynamic binding
- The Stroustrup video
The Kitchen Sink Program:
You are each to write one program that incorporates several of
the C++ presented during the past two weeks. In particular:
- Try to include at least six concepts, from six different presenters
(including yourself).
- Some familiar topics don't count. E.g. namespaces count,
scope doesn't; access modification counts; protected and virtual
count; etc. If in doubt ask.
- Try to choose concepts new, or previously unused, by you.
- Try to use the concept in a nontrivial way. E.g a declared
but unused namespace wouldn't be worth much. However, the use need
not be terribly significant.
- Small bonuses will be rewarded for including extra topics or
especially significant usage.
- Include comments in your program pointing out the concept
being used.
What your program actually accomplishes is of little
import.
Purpose: Gaining familiarity with more C++ concepts.
due: TBA
via: hsp. See Homework Submission Program
Presentations on Java. See
The 2nd Go-around
Purpose: An Intro to OOP in Java.
First Java Program: A Pretty Printer.
See #17 p.400 in Slack. Except write your Java program to pretty-print
an ill-formatted C++ program. Well, if it can pretty-print C++ it'll
probably do o.k. on Java.
Purpose: To get familiar with Java, use of classes and file i/o.
Hints: To get the name of a file you could: build it into the code,
assign it to a string, or ask the user. The last method makes it easier
to test and puts the grader in a better mood. A choice would be best.
If you get it from the user you can either use the Keyboard class
or the regular input. Your choice.
You can process the file a character at a time, a string at a time,
or a line at a time. Your choice.
If you use strings: in addition to the methods in the table on p. 202,
some useful
string methods are length(), charAt(), setCharAt() and trim().
I would develop the program incrementally (after pseudo coding it,
of course). First
I'd just get one of the programs in the book that handles file i/o to
work on a simple test file. Then I might make some simplifying
assumptions, such as the braces occur on lines by themselves already
and just take care of the indenting. Then remove such assumptions and
test on a larger test suite.
collusion: pair programming allowed (recommended).
deliverable: program via hsp. In the case of pairs each should
submit a copy and acknowledge the other in the program comment.
Due: Monday 4/23. One-day extensions granted to people presenting that day.)
Second Java Program: A Spelling Checker
See #9 p. 541 in Slack for starters.
Purpose: More familiarity with Java, use of classes, arrays, data structurs
and files.
Requirements: The minimal program should satify the description in
Problem #9. Your input should be from the keyboard and output to the
screen. You may use the Keyboard class or standard i/o.
Several immediate extensions are suggested:
- Add at least one other heuristic to obtain similar words.
- Check to see if the original word is in the dictionary. If so
do nothing more. You can use /usr/dict/words, for example, or your own little
dictionary. Do NOT copy a big dictionary, such as /usr/dict/words, into
your directory.
- Check to see if the "words" generated are in the dictionary.
Display only the ones that are, or "no matches" if none are. To be efficient you may want to
consider your options for data structures and algorithms.
>Do NOT use a GUI. That's for a later problem.
Hints: Watch this space.
collusion: pair programming allowed (recommended).
deliverable: by hsp. Make a subdirectory called Checker in your hsp directory.
Be sure to include any other files Include the program, checker.java,
and any files needed, such as your
own (little) dictionary. In the case of pairs each should
submit a copy and acknowledge the other in the program comment.
Due: MayDay 11:59 pm. One-day extensions granted to people presenting
the next day. For people going somewhere over the midterm break: To
be granted a two-day extension from the time you return, please
-
1) e-mail me when you're leaving, where you're going, and when you're
returning.
-
2) Before you leave, hsp a preliminary version or outline of your
program, call it checker0. I want you to at least get a start on the
design of your program before you leave so you don't have too much
to do upon your return. OK?
An Applet:
You each are to write an applet. Try to incorporate into it some
of the AWT and/or graphics that you've been learning about. The
default would be something along the lines of the spell checker.
Due: Wednesday 5/9. But please email me by Monday a brief description of
what you intend to do.
Deliverables: It's to be on your webpage. Email me the URL when you've
finished.
Hints: If you do the spell checker, you might want to have a smaller
dictionary in your directory. Or - for one way for an applet to access a
file in another directory see item # 8(Sect. 7) at
FAQ I/O
Collusion: People who haven't worked with webpages before should try to
work with someone who has. Thanks.
A Question for the Java Quiz:
Please submit via email or hardcopy a short question, based on your
presentation, for a quiz on Java. Short answer, what the difference between,
matching, fill in the ___, or multiple choice (but not true/false)
questions are appropriate. You will be given credit for your submission;
however, questions which are too easy (everyone gets it right) or too
hard (less than half the class gets it right) will receive less credit.
Questions, either yours or mine, on which the class does poorly will
be discounted. The quiz will be given on Monday 5/13. Your question,
together with a proposed answer, is due on Tuesday 5/8.
Collusion: Absolutely none.