CSU Long Beach
CECS 274
Programming and Problem Solving II
Syllabus
Schedule
Grading
Project 1
Project 2
Solution to Project 2
Project 3
Solution to Project 3
Project 4
Solution to Project 4
Project 5
Set Solution to Project 5
Map Solution to Project 5
Lecture Notes
Basic Unix Commands
Basic vi Commands
More vi Commands
Using Eclipse
Compiling and Running Java on Unix
Mimi Opkins Home
|
Project 4
Assignment
- For this assignment you will be writing a mini-word processor.
You are mainly concerned with inserting characters, deleting characters
and positioning the cursor. If you think about it, that's mostly what
the user does when entering or editing text. The user
only adds and deletes characters next to the cursor. You can
therefore get away with using two stacks. One stack holds the
characters to the left of the cursor. The other stack holds the
characters to the right of the cursor. This diagram shows how to
represent the word
elephantine with the cursor between
the letters p and h:
LEFT STACK RIGHT STACK ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ |_e_|_l_|_e_|_p_| |_h_|_a_|_n_|_t_|_i_|_n_|_e_| bottom top top bottom
To move the cursor right, you
would just pop the h
from the right stack and push it onto the left stack:
LEFT STACK RIGHT STACK ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ |_e_|_l_|_e_|_p_|_h_| |_a_|_n_|_t_|_i_|_n_|_e_| bottom top top bottom
- Build a
small word-processor class that uses this 2-stack representation. The
class will include methods for inserting and deleting characters, and
for moving the cursor. To help you along, you will implement the MiniWPI
interface that is linked here.
- Your MiniWP constructor must be able to take in an initial string.
- To test your class, you will retrieve the
commands from a FIFO Queue class then execute them.
- Make sure you use appropriate exception handling such as dealing
with an empty stack, entering invalid commands into the queue, etc.
- Make sure you document the program as specified in the grading
guidelines.
Document the methods describing their purpose, input and output.
- You will hand in a printout of the program(s), sample output and
a UML class diagram along with a demo in the lab.
Grading Criteria
You will be graded on the following components: - Does the program
do what is required
- Is it properly documented
- Is it fully tested
- Is it properly designed
|