University of Pittsburgh
  Spring 2004
CS0007:  Introduction to Computer Programming
Assignment 7: Encryption
DUE DATE
Wednesday, Apr 14, midnight
VALUE
25 points
BACKGROUND
Chapter 10, JBD
Encrypt.java

Objectives

This assignment is intended to get you some practice using files.  You will be inspecting the code presented in class and then modifying it to add some functionality.

What to do

Start by acquiring the code we covered in class, read it, run it, and get a feel for what it does.
  1. cd into your java directory
  2. copy the files over:  cp ~hclane/public/java/encrypt/* .
    • note the dot (period) at the end
  3. list the files (with ls) - make sure you see Encrypt.java (the others won't be used in this assignment)
  4. compile it
  5. create your own small text file with pico (or any editor) - make sure it has at least 3 lines of text and that it also begins with your userid (you will be turning this file in as well).
  6. encrypt it using Encrypt.class (see the source code for more directions)
Now you will make a slight modification to this program so that the encryption process is revealed to the user.
  1. Change the name of Encrypt.java and the class name (in the file) to include your user id.  (the mv command can be used to change a file name).
  2. Make sure your text file and the encrypted version also begin with your user id (rename them both if necessary)
  3. Augment the code so that when it is encrypting it prints to the screen (in addition to the output file).  You should have it print each character before and after the encryption.
  4. Recompile, test, debug, etc. 

Handing your work in

Copy the following three files to /afs/cs.pitt.edu/public/incoming/CS7-Lane/assignment7
  • Your augmented program (yourid-Encrypt.java) and the .class file.
  • Your source text file (yourid-source.txt)
  • Its encrypted version (yourid-secret.txt)

Suggestions/Hints

This is intended to take at most a few hours.  You are just copying code over and running it.  Then you are adding just a couple of lines of code to print stuff to the screen.  You should not
need to change any of the existing code, just add lines of code.

Last Updated: 4/7/04 by H. Chad Lane