Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1)This project will use The Vigenere Cipher to encrypt passwords. 2)Vigenere Cipher a)Simple letter substitution ciphers are ones in which one letter is substituted for

1)This project will use The Vigenere Cipher to encrypt passwords.

2)Vigenere Cipher

a)Simple letter substitution ciphers are ones in which one letter is substituted for another. Although their output looks impossible to read, they are easy to break because the relative frequencies of English letters are known.

b)The Vigenere cipher improves upon this. They require a key word and the plain text to be encrypted.

c)Example:

Suppose you have a key word: house

We would encrypt a message as follows:

The first letter would be encrypted using these correspondences:

original letter: a b c d e f g h i j k l m n o p q r s t u v w x y z

substitute letter: h i j k l m n o p q r s t u v w x y z a b c d e f g

The second letter would be encrypted using these correspondences:

original letter: a b c d e f g h i j k l m n o p q r s t u v w x y z

substitute letter: o p q r s t u v w x y z a b c d e f g h i j k l m n

The third letter would be encrypted using these correspondences:

original letter: a b c d e f g h i j k l m n o p q r s t u v w x y z

substitute letter: u v w x y z a b c d e f g h i j k l m n o p q r s t

etc

Once all characters in the key are used, the offset repeats starting over with the Keys first letter.

3)The cipher for this program is a little more complex as you must include punctuation so the password may be any of the characters in the ASCII table from character 33 the exclamation point ! to character 122 the lower case z.

4)User Class

a)The class that contains user information including the username, password, encrypted password and key (see UML class diagram below)

User

username : String

clearPassword : String

encryptedPassword : String

key : String

+User()

+User(String, String, String)

+getUserName() : String

+setUserName(String)

+getClearPassword(): String

+setClearPassword(String)

+getEncryptedPassword():String

+setEncryptedPassword(String)

+getKey(): String

+setKey(String)

-encrypt()

+toString():String

b)Constructors

i)Default constructor sets all fields to the empty String ()

ii)Parameterized constructors

(1)takes in the username, clearPassword and the key

(2)calls the private method encrypt to encrypt the clearPassword using the Vigenere Cypher.

c)Methods

i)Accessor and mutator methods as listed in the Class Diagram

ii)encrypt method

(1)Private method only accessible to other methods of the User class.

(2) Uses the Vigenere Cypher to encrypts the clearPassword instance variable using the key

(3)Stores the encrypted password in encryptPassword instance variable.

iii)toString returns a nicely formatted String representing the user to include username, encrypted password, clear password and key such as:

Jsmith ]Umka\f^ password house

5)Accounts Class

a)This class contains all the user objects for our company.

b)The classs instance variable includes company name, company address, and an ArrayList of User Objects (see UML class diagram below)

Accounts

companyName : String

companyAddress : String

users : ArrayList

NOTFOUND: int = -1

+Accounts()

+Accounts(String, String)

+getCompanyName(): String

+setCompanyName(String)

+getCompanyAddress(): String

+setCompanyAddress(String)

+addUser(User)

+getUser(String): User

+deleteUser(String):boolean

-findUser(String):int

+toString(): String

c)Instance Variables

i)companyName name of company

ii)companyAddress the address of the company

iii)users an ArrayList containing User Objects

d)Constructors

i)Default constructor sets company name and address to the empty String and creates an ArrayList of User objects

ii)Parameterized constructor sets the name and address parameters to the appropriate instance variable and creates the ArrayList of User Objects.

e)Methods

i)Accessor and mutator methods as listed in the Class Diagram

ii)addUser

(1)Takes in a User object

Adds that User object to the ArrayList

iii)getUser

(1)Takes in a String with the users username

(2)Calls the private findUser method to locate the index of the User object in the ArrayList.

(3)Returns the User object from the ArrayList that is associated with that username. (assume unique username)

(a)If the username does not exist

(i)print out the error message: does not exist.

(ii)Return null

iv)deleteUser

(1)Takes in a String with the users username

(2)Calls the private findUser method to locate the index of the User object in the ArrayList

(3)Returns true if user found and deleted, false if user not found.

v)findUser

(1)Private method that takes in a String representing a username

(2)Searches the ArrayList looking for this username (again assume usernames are unique)

(3)If found, returns the ArrayList index of the username

(4)If not found returns NOTFOUND constant.

vi)toString

(1)returns a nicely formatted String table representing all the users information in the ArrayList(see example below)

(2)use of the User toString method is advisable.

ABC Company 1234 Holly Lane, Pensacola Florida Username EncryPass ClearPass Key Jsmith ]Umka\f^ password house

mjones GYOX)r*z abcd1234 argos

6)AccountTester

a)The purpose of this class is to thoroughly test all the methods and constructors in the Accounts and User classes.

b)Methods can be tested directly or indirectly

c)Indirect testing is testing a method by calling another method such as

i)If the constructors calls the mutator methods when setting instance variables rather than setting them directly.

ii)If the toString method calls accessor method rather than accessing instance variables directly

d)No user input, just create variables and/or hardcode values

e)To simplify the program some,

i)All passwords are 8 legal characters (as outlined in the requirements)

ii)All keys are 5 characters

f)Program Flow (suggestion)

i)Create several User Objects

ii)Add each to the Accounts class

iii)Call the Accounts toString

iv)Search for username including one that is not found.

v)Delete a user account.

vi)Call Account toString before exiting.

7)Programming/Client Communication

a)When developing a program requirement are rarely perfect, ambiguities, omissions and errors are usually present.

b)To keep this communication organized please post to the appropriate Programming Project Topic any question you may have. I will answer those question there and thus we will have a written record.

c)If you ask a question in class, I will answer it but you need to post the question as well.

Submission Requirements:

Your project must be submitted using the instructions below. Any submissions that do not follow the stated requirements will not be graded.

1. You should have the following files for this assignment:

User.java - The User class

Accounts.java The collection class for User information.

AccountTester.java The testing class for this project

The javadoc files for all the User and Accounts classes (Do not turn in)

User.html

Account.html

2. Remember to compile and run your program one last time before you submit it. If your program will not compile, the graders will not be responsible for trying to test it.

3. Follow the submission requirements posted on elearning.

I need this for my intermediate java program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions