{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


1902hw2writeup - CSci 1902 Homework 2(version 2 Due...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSci 1902 – Homework 2 (version 2) Due: February 18, 2010, 4:00pm (before class) Purpose This homework assignment gets you working with Java arrays, loops, and Strings. Introduction One of the simplest methods of cryptography involves the selection of a random character to represent a given letter, and then replacing all instances of that letter with the random character. This is the definition of a "Substitution cipher". A variation of this technique is called the "Caesar cipher," as it was used by Julius Caesar to protect messages of military significance. In this cipher, each letter is replaced by another letter which is obtained by shifting the alphabet by a fixed amount, and wrapping the overflow. Caesar used a right- shift of three to encode his messages: Plain text: ABCDEFGHIJKLMNOPQRSTUVWXYZ Cipher text: DEFGHIJKLMNOPQRSTUVWXYZABC Note that the Caesar cipher only uses letters. Numbers, punctuation, and spaces are not encrypted. In this assignment, you will be writing code to implement the Caesar cipher. You will also attempt to decrypt a document that uses the Caesar cipher by comparing its letter frequency with the letter frequencies of a corpus of documents obtained from Project Gutenberg. Getting started The files for this assignment are available on the course website at: http://www-users.itlabs.umn.edu/classes/Spring-2010/csci1902/homeworks/1902hw2v2.zip Download this archive to your computer (you may choose to save this in your NetBeansProjects directory, or in some other directory where you are collecting your Java programs) and unzip it. To unzip the archive in linux, use the following command in a Terminal: unzip 1902hw2v2.zip (This command should be run from the directory where you saved the 1902hw2v2.zip file.) The unzipped directory is a NetBeans package, which consists of several files and subdirectories. You can open the package by using the “Open Package” menu, and selecting the top-level directory 1902HW2. Opening this package in NetBeans will automatically create the project's file hierarchy. The java files included in this project are in the src directory: CharacterReader.java Reads and stores the contents of a file CharCount.java Container class that represents a character and its count of occurrences Cipher.java Implements the encryption of text
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
EditorPanel.java Generates the graphical window MainWindow.java main() program Manhattan.java Calculates the Manhattan distance similarity score TextCharCounter.java Reads text from a file and generates an array of CharCounts Note that most of the files provided are complete, and you will not need to modify them. Familiarizing yourself with these classes can only help you to better understand and implement the task at hand. Text data is contained in the
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 5

1902hw2writeup - CSci 1902 Homework 2(version 2 Due...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online