Project 3 - A Simple Text Editor

Part 1 - Due - Friday, November 19, 2004

Part 2 - Due - Friday, December 3, 2004

The goal of this project is to give you an opportunity to practice implementing and using stacks and linked structures. You should also continue to use object-oriented design.

For this project, you will implement a text editor. Your editor will display a string of characters and a cursor. Your program will allow the user to move the cursor and modify the text using the following five operations:

A sample run of your program should look as follows:
^
insert S
S^
insert A
SA^
insert M
SAM^
insert M
SAMM^
insert Y
SAMMY^
left
SAMM^Y
left
SAM^MY
rdelete 2
SAM^
insert I
SAMI^
right
SAMI^
left
SAM^I
ldelete 3
^I

Your program should implement a LinkedStack class which provides a stack interface and stores a series of characters in a linked structure. You should declare two instances of this class. The first will store all of the text to the left of the cursor and the second will store all of the text to the right of the cursor. In addition to the typical stack ADT operations you must implement : (1) a print function for the stack which will print its contents and (2) a pop(i) function which will remove the top i (an integer) elements from the stack. Think carefully about what this special pop function should return.

Implementation Hints

You may use any portion of the LinkedStack available from http://cpp.datastructures.net/source/ch04.html. However, I strongly advise you to fully understand all parts of the code you choose to use because I will ask you to explain it. If you cannot, you will receive a lower grade. Also, keep in mind that you will need to provide some additional functionality for your LinkedStack.

Part 1 - Due Friday, November 19, 2004

For part 1, you must submit the design of your program and algorithms for each piece of your design. You must also submit the code for the LinkedStack class.

Part 2 - Due Friday, December 3, 2004

  1. Complete and submit your working code.
  2. Make sure that each function is well documented. Your documentation should specify the type and function of the input paramaters and ouput.
  3. Run your program on a variety of inputs ensuring that all error conditions are handled correctly.
  4. Make sure I have seen your program run. Unless you make alternate arrangements with me prior to the due date, you should demonstrate your program in the lab during 4th hour on the due date.
Reminder: No part of your code may be copied from any other source unless noted on this page. All other code submitted must be original code written by you.
Sami Rollins