Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This project will use The Vigenere Cipher to encrypt passwords. Simple letter substitution ciphers are ones in which one letter is substituted for another. Although

This project will use The Vigenere Cipher to encrypt passwords.

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.

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

Create a Java application that uses:

decision constructs

looping constructs

basic operations on an ArrayList of objects (find, change, access all elements)

more than one class and has multiple objects.

User Class

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

Constructors

Default constructor sets all fields to the empty String ()

Parameterized constructors

takes in the username, clearPassword and the key

calls the private method encrypt to encrypt the clearPassword using the Vigenere Cypher.

Methods

Accessor and mutator methods as listed in the Class Diagram

encrypt method

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

Uses the Vigenere Cypher to encrypts the clearPassword instance variable using the key

Stores the encrypted password in encryptPassword instance variable.

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

Accounts Class

This class contains all the user objects for our company.

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

Instance Variables

companyName name of company

companyAddress the address of the company

users an ArrayList containing User Objects

Constructors

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

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

Methods

Accessor and mutator methods as listed in the Class Diagram

addUser

Takes in a User object

Adds that User object to the ArrayList

getUser

Takes in a String with the users username

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

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

If the username does not exist

print out the error message: does not exist.

Return null

deleteUser

Takes in a String with the users username

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

Returns true if user found and deleted, false if user not found.

findUser

Private method that takes in a String representing a username

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

If found, returns the ArrayList index of the username

If not found returns NOTFOUND constant.

toString

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

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

AccountTester

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

Methods can be tested directly or indirectly

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

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

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

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

To simplify the program some, No error handling required

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

All keys are 5 characters

Program Flow (suggestion)

Create several User Objects

Add each to the Accounts class

Call the Accounts toString

Search for username including one that is not found.

Delete a user account.

Call Account toString before exiting.

Programming/Client Communication

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

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.

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

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

Building The Data Warehouse

Authors: W. H. Inmon

4th Edition

0764599445, 978-0764599446

More Books

Students also viewed these Databases questions

Question

1. What does your reader need to complete his or her task?

Answered: 1 week ago