CS 535 : Assignment
1 | CS 535 Object-Oriented Programming | |
---|
Fall Semester, 1997
CS 535: Assignment 1
To Assignment Index
San Diego State University -- This page last updated September 15,
1997
Due Tuesday, September 30, 1997
1) Write a program with three inputs: an escape character, a set of
special characters that must be escaped, and a string. The program will
place an escape character before each occurrence of a special character
and before each occurrence of the escape character in the original input
string. Print out the result of this process. So for example if the escape
character is:
- a
and if the set of special characters is:
- cd
and the string is:
- cadman
then the output would be:
- acaaadmaan
As this is an assignment to work on control structures and strings, so do
not use the classes SubstringCountReader and StringReplaceReader.
2) Write a program to reverse the process in problem one. That is given an
input of the escape character and an escaped string (the output of the
program of problem one) removed the escapes in the string. For example if
the escape character is:
- a
and the input string is:
- acaaadmaan
then the output will be:
- cadman
3) Implement a linked list. Each linked list element will hold a single int
value and be possibly linked to another linked list element. When new
elements are added to the list add them to the front of the list. Write a
program to add int values to a linked list, print the link list on the
standard output, and compute the average value in the linked list. It is not
necessary to implement deletion from the list.
In this assignment I am not too concerned with how you do input and
output. Using the sdsu.io.Console class for input and output is fine. You are
more than welcome to read and write to files or use standard streams, but
this is not necessary. In general it is preferable to produce simple
welldesigned solutions to poorlydesigned solutions with lots of fancy
features.
visitors since
September 15, 1997