Comp101 Lab 3


In this lab you will continue your java programming experience writing a very simple class with several methods. You will take the part of an applications programmer who is developing a class for another programmer who will build the actual application. 


You will be implementing a class to do some simple string manipulation. Annother application programmer has built a user interface (and isn't it a beauty!?!???) to function as an extreemly simple string manipulating toy program. Your job is to write class that does the string handling according to the specifications provided. Because the user interface is written for you, you must write your class exactly as it is specified.

First  copy the start file for this lab to your folder. After you login

cp ~jsantore/ .

Remember that that final dot is important for the command, its not punctuation.
unzip the file as usual


and then cd into the newly created Lab3 directory.

You have only one file this time. Morover, it will not compile until you do at least some of your assignment. When everything does compile and you run the program, you should see a window that looks alot like this:
Lab3 up and running

The behavior that we expect to see is this:

When you type some text into the two text boxes, select one of the radio buttons and press 'Do It'. The result will be displayed on the label next to the Do It button. (the one that says "THIS IS SILLY" in the picture above.) The radio buttons are described below:

Specifications of the class that you must write

You need to write a class with the following specifications. Since I've written a class that uses yours, your class name, method names, and Parameter lists must match those that I list below.
Most of the work that you will be doing in the methods that you have to write can be done for you by applying methods from the String class. As you know you can find those by searching through the API. But thats still a bit of work as early in your learning as you are so below are a few of the methods from the string class. All of the methods that you need (and one or two extra) to do this lab are found below.

Starting up

When you begin, I suggest that you let xemacs help you out a little. Once you are in your Lab3 folder, open the file that you get (the one in which I implemented the Graphical User Interface (GUI)) using xemacs


You don't need to look at this file closely or understand it since it does many things that you have not yet learned about.  Select the file menu and choose the "JDE New" submenu and then choose "class" from that submenu. xemacs will ask you in the for the name of the new java file. (in the small text bar at the bottom of xemacs - see image - note that the text colors might be different for you)
using xemacs and jde to create a new java class file
Next xemacs will pop up its "file open dialog asking for the file name of the new Java class you are creating
xemacs file open dialog prompting for the java file name

Type in You must define your java class in a file with the same name as the class itself (with the .java extension)
You're going to be promted to enter some information about the class as you can see in the image below. Don't bother with a package when prompted, just hit enter.
xemacs prompting for the package for your new java class
xemacs will now ask you what this class extends. We haven't learned about extending classes so you can simply type enter to default to nothing. The same with the next two questions about what this class implements.

Now you have a simple class outlined for you. It has a constructor (to which you still need to add the correct parameter ) and nothing more. Now add the instance variable, fix the contructor and add the rest of the methods that you need.


When you submit this time, add a readme.txt file to your Lab3 folder that you are building. (In xemacs you create a new file by doing <file><open file> and typing in a brand new file name. The readme should contain:
Once you have the readme done, cd into your parent folder, zip up the entire Lab3 folder using the -r flag as you have learned in the last two labs, and use the online submission program to submit it to me.

Due  Monday Feb 25th at 11:59pm (note holiday weekend  and odd schedule between now and then)