Comp101 Lab 3


Introduction:

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. 

Objectives:



You will be implementing a class to do some simple calculations. Annother application programmer has built a user interface (perhaps there was a reason that your predecessor moved on?) to function as an extreemly simple calculator. Your job is to write class that does the calculations 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 skeleton file for this lab to your folder. After you login

cp ~jsantore/Lab3Skeleton.zip .

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

unzip Lab3Skeleton.zip

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:initial appearance of the lab3 program

The behavior that we expect to see is this:

When you type an integer into the two text boxes, select one of the radio buttons and press calculate. The result will be displayed on the label next to the calculate button. (the one that says "No Calculations yet" in the picture above.) Note that there might be an apparently inaccurate result with division. We'll talk about integer division soon. If everything else works and division seems to be off by one, then you are all set.

Specifications of the class that you must write

You need to write a class with the following specifications

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 with the GUI in xemacs

xemacs Lab3App.java&

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.
emacs querying for a file name
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 you won't have the Calculations.java files in your window when you do yours - I've already written a copy in mine.)
choosing the new file name
Type in Calculations.java. Remember, you must define your java class in a file with the same name as the class itself (with the .java extension)
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 question 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.

Submitting

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 or using konqueror as you have learned in the last two labs. Make sure that you include your last name as part of the file name. If you used konqueror to zip up the file, use konqueror to rename to file to include your last name. for example I would use: SantoreLab3.zip

 Once you have the zip file, use the online submission program to submit it to me.

Due  Friday Oct 10th at 11:59pm