handout #4

CS227 ¾ Program Design & Development

Programming Assignment #1

due 3 pm Wednesday, September 1st

You will not have to do any original programming for this assignment.  You will be filling in a program file with code that was developed in class (see handout #3).  This assignment is meant to ensure that you have either set up your home computer or your NT account so that you can complete homework assignments.  As noted in the fact sheet, this assignment will count only half what the later assignments will count (10 points instead of 20).

The instructions below are intended for students who will be using the Harvill lab.  If you will be using your own computer, you can instead complete these steps from home.

First we want you to log in to your NT account.  It should have the same user name as your Lectura account.  Your password should be the first 6 letters of your student id.  If you had a Lectura account previously, then your account password will instead be your Lectura account name (if your account name is less than 6 spaces, you should append a sequence of sequential integers starting at 1 to pad it out to 6 spaces, as in abt becoming abt123).  When you first log in, you will be asked to select a new password.

Several things will happen when you log in.  Probably the system will try to set you up for Internet Explorer.  It might generate the error message “INF Install failure”.  This can be ignored (just click OK).  If you don’t want to have the Internet Explorer window come up every time you log in, you can select that option in the dialog box that comes up.

Next we want to make sure your Lectura account exists and that you can log in to it.  There is a “short cut” for this on your desktop called “connect to Lectura”.  Double-click on it.  This should connect you to Lectura where it will prompt for your user name.  Keep in mind that Lectura has a separate password from your NT account.  You can use the same password for each if you want to, but you must set them separately.

Something somewhat confusing will happen when you first log in to Lectura.  First you will be prompted for your password to log in and then you will be immediately prompted to change your password.  But because of the way this program is run, you have to type the original password two times in a row.  So for your first log in you will have to type:

1.      initial passwd (first 6 digits of your student id)

2.      initial passwd again (first 6 digits--to satisfy the passwd program)

3.      new passwd

4.      new passwd to verify

Your account should now be ready to use.  The next step is to set up mail forwarding in case you read your email somewhere other than Lectura.  To set it up, give this command:

forward

It will prompt you for an email address to use for forwarding your mail.  At this point you can disconnect from Lectura by giving the command “logout” (if you selected something other than the standard shell when you requested your account, you might need to type “exit” instead).

Next you need to configure TextPad following the instructions on the back of handout #2.

Now you want to start navigating the folders you will be using this semester.  Double-click on the “My Computer” icon in the upper-left corner of the screen.  You should see two folders inside, one labeled H: and one labeled X:.  The H: folder is your home directory where you will store your own program files.  The X: folder is the class directory where we will provide you files to use in your programming assignments.  It would be a good idea to click on each of these and drag it to the desktop.  You will be asked if you want to create a shortcut on the desktop and you should say yes.  With the shortcuts you won’t have to open the “My Computer” folder every time you want to access these folders.

Double-click on the X: folder.  You will see two folders inside, one called source and one called turnin.  We will use the source folder for all files we want to provide you for your programming assignments.  We will not use the turnin folder for now, but if we decide to use electronic turnin later in the semester, we will tell you how to use this folder.  Double-click on the source folder and you will see a folder inside called “prog1”.  All of your programming assignments will have a folder of files that you need for the assignment.  Click on the prog1 folder and drag it to your H: folder (to your home directory).

Now double-click on your H: folder and double-click on the prog1 folder you’ve just copied there.  Then double-click on the file called AddingMain.java.  If you have configured TextPad properly, this file should be opened in TextPad.

This file contains two classes in it.  The first class is the Accumulator class discussed in lecture.  At the end is the AddingMain class with the main method.  These two classes have been put together into one file to simplify your work.  You should leave the AddingMain class code in the file and just ignore it.  You are to pay attention to the Accumulator class.  It has what are called “stubs” for all of the methods.  You need to complete each method.  You should copy the definitions from handout #2 exactly.  You are not to change any variable names, for example.  You should include at the top of the file your own name, the date and your grader’s name.  The Accumulator class itself is to be exactly the same as in handout #3 except for the fact that you shouldn’t include the word “public” in front of the class name (the file is already set up this way, just be sure not to add the word “public”).

When you think you have successfully copied the code from handout #3, you can use the “Java Compiler” and “Run Java” commands under the Tools menu in TextPad to compile and execute the program.  It should behave exactly as demonstrated in class, like a simple adding machine.

Once your version compiles and runs properly, print the file.  You should turn this in during class.  You do not have to print the other files in the prog1 folder.