Question

This project will use The Vigenere Cipher to encrypt passwords. Simple letter substitution ciphers are ones...

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 class’s 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 user’s 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 user’s 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 constructor’s 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

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

User.html

Account.html

0 0
Add a comment Improve this question Transcribed image text
Answer #1

AccountTester.java

public class AccountTester
{
  
public static void main(String[] args)
{
   Accounts acct = new Accounts("UWF CP DEPT","\n1342 Pine DR. \nPalm Beach, Fl 32585",10);
   System.out.println(acct.getCompanyName());
   System.out.println(acct.getCompanyAddress());
   acct.setComapnyName("USF SD Dept");
   acct.setCompanyAddress("1342 Pine DR. , Pensacola Florida");
  
   User user1 = new User("user1","password","","house");
   User user2 = new User("user2","drowssap","","stepp");
   User user3 = new User("user3","wordpass","","drown");
   User user4 = new User("user4","ssapdrow","","T@1ks");
   User user5 = new User("user5","21abc!56","","Sky3D");
   User user6 = new User("user6","!@#$%^&*","","51V8e");
   User user7 = new User("user7","A!1B3#mt","","56k*/");
   System.out.println(user1.getUserName());
   System.out.println(user2.getClearPassword());
   System.out.println(user3.getEncryptedPassword());
   System.out.println(user4.getKey());
   System.out.println(user5.toString());
  
   acct.addUser(user1);
   acct.addUser(user2);
   acct.addUser(user3);
   acct.addUser(user4);
   acct.addUser(user5);
   acct.addUser(user6);
   acct.addUser(user7);
   System.out.println(acct.user[0].toString());
   System.out.println(acct.user[5].toString());
  
   user2.setClearPassword("validUS!");
   user2.setKey("somes");
   user2.setUserName("helpd");
   System.out.println(acct.toString());
   acct.getUser("user5");
   acct.deleteUser("user56");
   acct.deleteUser("user5");
   acct.getUser("user5");
   System.out.println(acct.toString());
   user2.setEncryptedPassword("ecrd_psd");
   System.out.println(acct.toString());
}

}

Accounts.java

public class Accounts
{
   String companyName;
   String companyAddress;
   int numOfelements = 0;      
   User[] user;
   int NOTFOUND = -1;
   int arraySize;
   Accounts()
   {
   this("","", 10);
   arraySize = 10;
  
   }
   Accounts(String CompanyName, String CompanyAddress, int Size)
   {
       companyName = CompanyName;
       arraySize = Size;
       companyAddress = CompanyAddress;
       user = new User[arraySize];
   }
   
   public String getCompanyName()
   {
       return companyName;
   }
   public void setComapnyName(String name)
   {
       companyName = name;
   }
   
   public String getCompanyAddress()
   {
       return companyAddress;
   }
  
   public void setCompanyAddress(String address)
   {
       companyAddress = address;
   }
  
   public void addUser(User usr)
   {
       if (numOfelements == arraySize)
       {
       System.out.println("User array is full");  
       }
       else
       {
       user[numOfelements] = usr;
       numOfelements++;
       }
   }
   public User getUser(String usrName)
   {
       int index;
       index = findUser(usrName);
       if (index == -1)
       {
       System.out.println(usrName + " does not exist.");
       return null;
       }
       else
       {
       return user[index];
       }
   }
  
   public void deleteUser(String usrName)
   {
       int counter;
       counter = findUser(usrName);
       if(counter == -1)
       {
       System.out.println(usrName + " does not exist");
       }
       else
       {
           numOfelements = numOfelements - 1;
          
       while(counter < numOfelements)
       {
           user[counter] = user[counter + 1];
           counter++;
       }
       }
      
      
   }
  
   private int findUser(String usrName)
   {
       int counter;
       for(counter = 0; counter < numOfelements; counter ++)
       {
           if(user[counter].username == usrName)
           {
               break;
           }
       }
       if(counter == numOfelements)
       {
           return NOTFOUND;
       }
       else
       {
       return counter;
       }
   }
  
   public String toString()
   {
       String sent;
       sent = getCompanyName() + " " + getCompanyAddress() + "\n\n" +
       "Username Encrypted Clear Key\n-----------------------------------\n";
       for(int count = 0; count < numOfelements; count++)
       {
       sent = sent + user[count].toString();  
       }
       return sent;
   }
}


User.java


public class User
{
   String username;
   String clearPassword;
   String encryptedPassword;
   String key;
  
   User()
   {
       this("","","","");
   }
  
   User(String userName, String ClearPassword, String EncryptedPassword, String Key)
   {
   this.username = userName;
   this.clearPassword = ClearPassword;
   this.encryptedPassword = EncryptedPassword;
   this.key = Key;
   encrypt();
   }

        public String getUserName()
   {
       return username;
   }
   public void setUserName(String user)
   {
       username = user;  
   }
   public String getClearPassword()
   {
       return clearPassword;
       }
   public void setClearPassword(String clearPass)
   {
       clearPassword = clearPass;
       encrypt();
   }
   public String getEncryptedPassword()
   {
       return encryptedPassword;
   }
   public void setEncryptedPassword(String encryptPass)
   {
       encryptedPassword = encryptPass;  
   }
        public String getKey()
   {
       return key;
   }
   public void setKey(String key1)
   {
       key = key1;  
   }
  
   public void encrypt()
   {
       int asciiPass;
       int asciiKey;
       int passwordLength = clearPassword.length(); //
       int y = 0;
       int keylength = key.length();
       encryptedPassword = "";
  
       for (int x = 0; x < passwordLength; x++)
       {
           asciiPass = (int)clearPassword.charAt(x);
           asciiKey = (int)key.charAt(y);
           asciiPass = asciiKey + asciiPass;
           y++;
          
           if (y >= keylength)
           {
               y = y - key.length();
           }
           encryptedPassword = encryptedPassword + (char)asciiPass;  
           }
   }
   public String toString()
   {
   String sent;
   sent = username + " " + encryptedPassword +" "+ clearPassword +" "+ key + "\n";
   return sent;
   }
}

Accounts.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_144) on Tue Sep 12 20:31:38 CDT 2017 -->
<title>Accounts</title>
<meta name="date" content="2017-09-12">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
    try {
        if (location.href.indexOf('is-external=true') == -1) {
            parent.document.title="Accounts";
        }
    }
    catch(err) {
    }
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!--   -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Accounts.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev&nbsp;Class</li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="index.html?Accounts.html" target="_top">Frames</a></li>
<li><a href="Accounts.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
    allClassesLink.style.display = "block";
}
else {
    allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<h2 title="Class Accounts" class="title">Class Accounts</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>Accounts</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">Accounts</span>
extends java.lang.Object</pre>
<div class="block">Accounts class</div>
<dl>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd>omarg

the Account class is a holder class. It holds multiple classes in an array
It also has its own methods that can be called
The account class holds a company name, address, and list of users
The information can be altered by calling methods</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="Accounts.html#addUser-User-">addUser</a></span>(User&nbsp;usr)</code>
<div class="block">addUser is a method that takes in a User class
The method then checks with the global variable arraySize and numOfelements
to make sure the user array is not full
If the array is full, the program warns the user and the action is canceled</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="Accounts.html#deleteUser-java.lang.String-">deleteUser</a></span>(java.lang.String&nbsp;usrName)</code>
<div class="block">the deleteUser method deletes a user class that is requested by the user
the method takes in a string.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="Accounts.html#getCompanyAddress--">getCompanyAddress</a></span>()</code>
<div class="block">simple method that returns the company address</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="Accounts.html#getCompanyName--">getCompanyName</a></span>()</code>
<div class="block">simple method that returns the company name.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>User</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="Accounts.html#getUser-java.lang.String-">getUser</a></span>(java.lang.String&nbsp;usrName)</code>
<div class="block">the method getUser retrieve the user that is requested by the user
it implements the findUser method found below
the findUser method returns the number index of where the user is located
this method uses the index number to find the actual user class in the user array</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="Accounts.html#setComapnyName-java.lang.String-">setComapnyName</a></span>(java.lang.String&nbsp;name)</code>
<div class="block">this method sets the companyName to a user defined string
it is used when the user wants to change the current company name</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="Accounts.html#setCompanyAddress-java.lang.String-">setCompanyAddress</a></span>(java.lang.String&nbsp;address)</code>
<div class="block">this is a method that replaces the current company address with a new user defined string</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="Accounts.html#toString--">toString</a></span>()</code>
<div class="block">this method creates a string method with all the accounts information
it users the acount information than uses a for loop to add each users toString methods
the string sent is a variable that holds the string information</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>equals, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="getCompanyName--">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCompanyName</h4>
<pre>public&nbsp;java.lang.String&nbsp;getCompanyName()</pre>
<div class="block">simple method that returns the company name.</div>
</li>
</ul>
<a name="setComapnyName-java.lang.String-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setComapnyName</h4>
<pre>public&nbsp;void&nbsp;setComapnyName(java.lang.String&nbsp;name)</pre>
<div class="block">this method sets the companyName to a user defined string
it is used when the user wants to change the current company name</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - is the variable that replaces the value of the @param companyName</dd>
</dl>
</li>
</ul>
<a name="getCompanyAddress--">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCompanyAddress</h4>
<pre>public&nbsp;java.lang.String&nbsp;getCompanyAddress()</pre>
<div class="block">simple method that returns the company address</div>
</li>
</ul>
<a name="setCompanyAddress-java.lang.String-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setCompanyAddress</h4>
<pre>public&nbsp;void&nbsp;setCompanyAddress(java.lang.String&nbsp;address)</pre>
<div class="block">this is a method that replaces the current company address with a new user defined string</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>address</code> - holds the user defined string that replaces the current address</dd>
</dl>
</li>
</ul>
<a name="addUser-User-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addUser</h4>
<pre>public&nbsp;void&nbsp;addUser(User&nbsp;usr)</pre>
<div class="block">addUser is a method that takes in a User class
The method then checks with the global variable arraySize and numOfelements
to make sure the user array is not full
If the array is full, the program warns the user and the action is canceled</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>usr</code> - is a User class that is inserted into the array
it contains the information the user is trying to push into the array
numOfelements guides the program to where the next class should go
the program should add a new class in the next available space and
most not replace any previus value</dd>
</dl>
</li>
</ul>
<a name="getUser-java.lang.String-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getUser</h4>
<pre>public&nbsp;User&nbsp;getUser(java.lang.String&nbsp;usrName)</pre>
<div class="block">the method getUser retrieve the user that is requested by the user
it implements the findUser method found below
the findUser method returns the number index of where the user is located
this method uses the index number to find the actual user class in the user array</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>usrName</code> - is the user defined username. it is pushed into the method as a string
the string is then pushed into the the findUser as a string
Int index is the numerical location of the user class in the array. if the user does not exist,
the index is set as -1 which means not found. A if loop is used to make sure the userName was found.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>returns the class that is requested by the user</dd>
</dl>
</li>
</ul>
<a name="deleteUser-java.lang.String-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>deleteUser</h4>
<pre>public&nbsp;void&nbsp;deleteUser(java.lang.String&nbsp;usrName)</pre>
<div class="block">the deleteUser method deletes a user class that is requested by the user
the method takes in a string. the string is pushed into the findUser method to find the
location of the user.
the int value counter is used to keep track of the array list
it is given the value of the index location. if the username does not exist,
it will be set to -1 and give the user a warning
the method shifts all the values after the requested username down, which overwrites
the requested username. The numOfelements variable is reduced by one since we deleted an element</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>usrName</code> - is the username requested by the user</dd>
</dl>
</li>
</ul>
<a name="toString--">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>toString</h4>
<pre>public&nbsp;java.lang.String&nbsp;toString()</pre>
<div class="block">this method creates a string method with all the accounts information
it users the acount information than uses a for loop to add each users toString methods
the string sent is a variable that holds the string information</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!--   -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Accounts.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev&nbsp;Class</li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="index.html?Accounts.html" target="_top">Frames</a></li>
<li><a href="Accounts.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
    allClassesLink.style.display = "block";
}
else {
    allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>


User.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_144) on Tue Sep 12 20:31:48 CDT 2017 -->
<title>User</title>
<meta name="date" content="2017-09-12">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
    try {
        if (location.href.indexOf('is-external=true') == -1) {
            parent.document.title="User";
        }
    }
    catch(err) {
    }
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!--   -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/User.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev&nbsp;Class</li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="index.html?User.html" target="_top">Frames</a></li>
<li><a href="User.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
    allClassesLink.style.display = "block";
}
else {
    allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<h2 title="Class User" class="title">Class User</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>User</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">User</span>
extends java.lang.Object</pre>
<div class="block">User class</div>
<dl>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd>omarg

This is a user class. it creates users and holds their information
The class contains methods that can change or retrieve values</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="User.html#encrypt--">encrypt</a></span>()</code>
<div class="block">the method encrypt is very important.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="User.html#getClearPassword--">getClearPassword</a></span>()</code>
<div class="block">the method returns the global variable clearPassword</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="User.html#getEncryptedPassword--">getEncryptedPassword</a></span>()</code>
<div class="block">this method returns the encryptedPassword String</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="User.html#getKey--">getKey</a></span>()</code>
<div class="block">method that returns the key string</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="User.html#getUserName--">getUserName</a></span>()</code>
<div class="block">Simple method to return username</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="User.html#setClearPassword-java.lang.String-">setClearPassword</a></span>(java.lang.String&nbsp;clearPass)</code>
<div class="block">sets the global clearPassword to a user defined string</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="User.html#setEncryptedPassword-java.lang.String-">setEncryptedPassword</a></span>(java.lang.String&nbsp;encryptPass)</code>
<div class="block">this method sets the encryptedPassword variable to a user defined string
the method does not call the encrypt method since it is the encrypted password</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="User.html#setKey-java.lang.String-">setKey</a></span>(java.lang.String&nbsp;key1)</code>
<div class="block">sets the key global variable to a user defined key string</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="User.html#setUserName-java.lang.String-">setUserName</a></span>(java.lang.String&nbsp;user)</code>
<div class="block">sets the global variable username to a user defined username</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="User.html#toString--">toString</a></span>()</code>
<div class="block">this method organizes all the user information into a String variable
string sent(short for sentence) holds the sentence</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>equals, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="getUserName--">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getUserName</h4>
<pre>public&nbsp;java.lang.String&nbsp;getUserName()</pre>
<div class="block">Simple method to return username</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>returns global variable username</dd>
</dl>
</li>
</ul>
<a name="setUserName-java.lang.String-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setUserName</h4>
<pre>public&nbsp;void&nbsp;setUserName(java.lang.String&nbsp;user)</pre>
<div class="block">sets the global variable username to a user defined username</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>user</code> - this holds the user defined username</dd>
</dl>
</li>
</ul>
<a name="getClearPassword--">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getClearPassword</h4>
<pre>public&nbsp;java.lang.String&nbsp;getClearPassword()</pre>
<div class="block">the method returns the global variable clearPassword</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>returns the clearPassword variable</dd>
</dl>
</li>
</ul>
<a name="setClearPassword-java.lang.String-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setClearPassword</h4>
<pre>public&nbsp;void&nbsp;setClearPassword(java.lang.String&nbsp;clearPass)</pre>
<div class="block">sets the global clearPassword to a user defined string</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>clearPass</code> - holds the value for the user defined password
the method then calls the encrypt method to encrypt the password</dd>
</dl>
</li>
</ul>
<a name="getEncryptedPassword--">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEncryptedPassword</h4>
<pre>public&nbsp;java.lang.String&nbsp;getEncryptedPassword()</pre>
<div class="block">this method returns the encryptedPassword String</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>returns the encrypted password</dd>
</dl>
</li>
</ul>
<a name="setEncryptedPassword-java.lang.String-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setEncryptedPassword</h4>
<pre>public&nbsp;void&nbsp;setEncryptedPassword(java.lang.String&nbsp;encryptPass)</pre>
<div class="block">this method sets the encryptedPassword variable to a user defined string
the method does not call the encrypt method since it is the encrypted password</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>encryptPass</code> - is the user defined String</dd>
</dl>
</li>
</ul>
<a name="getKey--">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getKey</h4>
<pre>public&nbsp;java.lang.String&nbsp;getKey()</pre>
<div class="block">method that returns the key string</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>returns the key string</dd>
</dl>
</li>
</ul>
<a name="setKey-java.lang.String-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setKey</h4>
<pre>public&nbsp;void&nbsp;setKey(java.lang.String&nbsp;key1)</pre>
<div class="block">sets the key global variable to a user defined key string</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key1</code> - the user defined string</dd>
</dl>
</li>
</ul>
<a name="encrypt--">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>encrypt</h4>
<pre>public&nbsp;void&nbsp;encrypt()</pre>
<div class="block">the method encrypt is very important. It encrypts the users clear password
the method deconstructs the clearPassword and key strings into chars
asciiPass is the ascii value of the current password char
asciiKey is the key value of the current key char
passwordLength is the number of char in the password String
keyLength is the number of char in the key String
the encrypted password is set to a default ""
int y is the counter for the asciikey. It is reseted to 0 if the y value is greater than the key size.
the password can be longer than the key, so it must be accomodated for it
int x is in a for loop. It is in a counter for the asciipass variable
the sciiKey variable is added into the asciiPass variable to create an encryped ascii key
the encrypted ascii value replaces the asciiPass value
the asciiPass value is then type casted and added to the encryptedPassword String</div>
</li>
</ul>
<a name="toString--">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>toString</h4>
<pre>public&nbsp;java.lang.String&nbsp;toString()</pre>
<div class="block">this method organizes all the user information into a String variable
string sent(short for sentence) holds the sentence</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!--   -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/User.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev&nbsp;Class</li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="index.html?User.html" target="_top">Frames</a></li>
<li><a href="User.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
    allClassesLink.style.display = "block";
}
else {
    allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>


Problems Javadoc Declaration Con Coverage <terminated> AccountTester [Java Application] Program FilesJava\jdk1.8.0_131\bin ja

Add a comment
Know the answer?
Add Answer to:
This project will use The Vigenere Cipher to encrypt passwords. Simple letter substitution ciphers are ones...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Java Project Requirements: Account class Superclass Instance variables clearPassword String Must be at least 8 characters...

    Java Project Requirements: Account class Superclass Instance variables clearPassword String Must be at least 8 characters long encryptedPassword : String key int Must be between 1 and 10(inclusive) accountId - A unique integer that identifies each account nextIDNum – a static int that starts at 1000 and is used to generate the accountID no other instance variables needed. Default constructor – set all instance variables to a default value. Parameterized constructor Takes in clearPassword, key. Calls encrypt method to create...

  • 1.     This project will extend Project 3 and move the encryption of a password to a...

    1.     This project will extend Project 3 and move the encryption of a password to a user designed class. The program will contain two files one called Encryption.java and the second called EncrytionTester.java. 2.     Generally for security reasons only the encrypted password is stored. This program will mimic that behavior as the clear text password will never be stored only the encrypted password. 3.     The Encryption class: (Additionally See UML Class Diagram) a.     Instance Variables                                                i.     Key – Integer...

  • Java: Please help with my Tester. I'm having a hard time figuring out my error. Thank...

    Java: Please help with my Tester. I'm having a hard time figuring out my error. Thank you. What the tester requires: The AccountTester This class should consists of a main method that tests all the methods in each class, either directly by calling the method from the Tester or indirectly by having another method call a method. User and Bot information will be read from a file. A sample file is provided. Use this file format to aid in grading....

  • Amusement Park Programming Project Project Outcomes Use the Java selection constructs (if and if else). Use...

    Amusement Park Programming Project Project Outcomes Use the Java selection constructs (if and if else). Use the Java iteration constructs (while, do, for). Use Boolean variables and expressions to control iterations. Use arrays or ArrayList for storing objects. Proper design techniques. Project Requirements Your job is to implement a simple amusement park information system that keeps track of admission tickets and merchandise in the gift shop. The information system consists of three classes including a class to model tickets, a...

  • // Client application class and service class Create a NetBeans project named StudentClient following the instructions...

    // Client application class and service class Create a NetBeans project named StudentClient following the instructions provided in the Starting a NetBeans Project instructions in the Programming Exercises/Projects Menu on Blackboard. Add a class named Student to the StudentClient project following the instructions provided in the Starting a NetBeans Project instructions in the Programming Exercises/Projects Menu on Blackboard. After you have created your NetBeans Project your application class StudentC lient should contain the following executable code: package studentclient; public class...

  • Language is JAVA. Clarification for the Shape class (highlighted): The following requirements specify what fields you...

    Language is JAVA. Clarification for the Shape class (highlighted): The following requirements specify what fields you are expected to implement in your Shape class; - A private String color that specifies the color of the shape - A private boolean filled that specifies whether the shape is filled - A private date (java.util.date) field dateCreated that specifies the date the shape was created Your Shape class will provide the following constructors; - A two-arg constructor that creates a shape with...

  • Start a new project in NetBeans that defines a class Person with the following: Instance variables...

    Start a new project in NetBeans that defines a class Person with the following: Instance variables firstName (type String), middleInitial (type char) and lastName (type String) (1) A no-parameter constructor with a call to the this constructor; and (2) a constructor with String, char, String parameters (assign the parameters directly to the instance variables in this constructor--see info regarding the elimination of set methods below) Accessor (get) methods for all three instance variables (no set methods are required which makes...

  • need help in Java Now we’ll continue our project by writing a Facebook class that contains an ArrayList of Facebook user...

    need help in Java Now we’ll continue our project by writing a Facebook class that contains an ArrayList of Facebook user objects. The Facebook class should have methods to list all of the users (i.e. print out their usernames), add a user,delete a user, and get the password hint for a user You will also need to create a driver program. The driver should create an instance of the Facebook class and display a menu containing five options: list users...

  • 1) Given the following “BasicAccount” class #include <iostream> #include <string> class BasicAccount {    private:      ...

    1) Given the following “BasicAccount” class #include <iostream> #include <string> class BasicAccount {    private:       std::string m_username ;       std::string m_password ;    public:       BasicAccount(std::string username, std::string password)       {          m_username = username ;          m_password = password ;       }               virtual std::string toString()       {          return "USERNAME(" + m_username + ") PASSWORD(" + m_password + ")" ;       }          std::string getUserName()       {          return m_username ;       }      virtual...

  • DIRECTIONS FOR THE WHOLE PROJECT BELOW BigInt class The purpose of the BigInt class is to...

    DIRECTIONS FOR THE WHOLE PROJECT BELOW BigInt class The purpose of the BigInt class is to solve the problem using short methods that work together to solve the operations of add, subtract multiply and divide.   A constructor can call a method called setSignAndRemoveItIfItIsThere(). It receives the string that was sent to the constructor and sets a boolean variable positive to true or false and then returns a string without the sign that can then be processed by the constructor to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT