QuestionQuestion

Create and test an application that will allow a user to create a text file to store data values associated with Player objects. The application will provide a menu for a user to display an encrypted list, display a decrypted list, add, update, and delete the Player data record in the text file. The menu will also contain a help command for the user to display the menu and an exit command to stop the execution of the application.
The menu will also have a and according to the specifications below.
Specifications
1. There are many ways to design a solution to this problem but you are graded on meeting the specific specifications as given in this exam.
2. Use proper statement indentation and meaningful variable names in the code.
3. Place a multi-line Javadoc comment (not multiple single line comments) giving a description of what this application does before the class header. Include your name and the date:
4. Output spacing, formatting, and spelling are to match the example console output illustrated above, but of course the user input will be different.
5. Display a menu for a user to display an encrypted list, display a decrypted list, add, update, and delete the Player data record in the text file. It will also provide a help command and exit command.
6. Implement each option on the menu.
7. Create and use a DAO interface as described in the textbook for this application. Create any other classes you need to meet the specifications as given. (5 points)
8. Eliminate this specification
9. The Player password must be at least 8 characters in length and no more than 20 characters in length.
10. Create a superclass named Player that implements the interface. It has three instance variables. One is for the player’s name, one for the amount of money the player has, and one for the player’s password. Create getter and setter methods for all the instance variables. Create any other methods necessary to meet all the specifications given in this exam.
11. Create two Player constructors. One will have no parameters and one will have the name, password, and the amount of money parameters.
12. The password secret encryption algorithm is sequenced below:
1. The first two characters will be moved to the end of the string of characters.
2. A random number greater than 0 and less than 10 will be inserted between the 2 and third characters in the string
3. An asterisk ( * ) will be place after the 7th character
4. The first character of the Players’ name will be the last character in the password.
13. The password is stored and displayed as encrypted. The Player class will also have a method to display the decrypted password.
14. Add and use the Console class from chapter 7 or a modified version to validate all user input data.
15. Create three packages to hold the six classes in the application. One to contain the player class, one to contain the I/O (input/output) classes, the third to contain the class with the main method and its other methods. Give the packages appropriately descriptive names.
16. Prompt the user for data.
17. Validate the data so only acceptable values will be processed. If the user enters invalid data at any time in the application, the application should display an appropriate error message and prompt the user again until the user enters valid data. See example console display test above. See example console display file.
18. Format currency values where illustrated in example output above. Look up NumberFormat class in index of textbook for help.
19. Eliminate this specification.
20. Add Javadoc comments to describe the purpose of every class in the application. (3 points)
21. Add Javadoc comments to describe the purpose of every method in the application include @param and @return comments.
22. Upon completion of the application generate the Javadoc documentation file. Be sure it includes the entire application documentation.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

package app;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
* This class represents the player which implements the PlayerDAO
* interface. It implements methods to add, update, delete players
* in the list.
*/
public class Player implements PlayerDAO<Player>{

    private String name;

    private double amount;

    private String password;

    private List<Player> lst;

    /**
    * Default constructor.
    */
    public Player() {
       lst = new ArrayList<>();
    }

    /**
    * Parameterised Constructor.
    * @param name The name of the player.
    * @param amount Amount on the table.
    * @param password The player's password.
    */
    public Player(String name, double amount, String password) {
       this.name = name;
       this.amount = amount;
       this.password = password;
       lst = new ArrayList<>();
    }

    /**
    * Gets the name of the player.
    * @return the name
    */
    public String getName() {
       return name;
    }

    /**
    * Sets the name of the player
    * @param name the name of the player
    */
    public void setName(String name) {
       this.name = name;
    }

    /**
    * Gets the amount on the table.
    * @return the name.
    */
    public double getAmount() {
       return amount;
    }

    /**
    * The amount on the table.
    * @param amount the amount.
    */
    public void setAmount(double amount) {
       this.amount = amount;
    }

    /**
    * Gets the password.
    * @return the password.
    */
    public String getPassword() {
       return password;
    }

    /**
    * Sets the password
    * @param password the input password.
    */
    public void setPassword(String password) {
       this.password = password;
    }

    /**
    * This method decrypt the password as per the algorithm.
    * @return the decrypted password.
    */
    public String encrypt(){
       String firstTwo = password.substring(0, 2);
       String pass = password.substring(2);
       pass += firstTwo;
       Random random = new Random();
       String rand = "" + random.nextInt(10);
       String first = pass.substring(0, 2);
       first += rand;
       String last = pass.substring(2);
       pass = first + last;
       first = pass.substring(0, 7);
       first += "*";
       last = pass.substring(7);
       pass = first + last;
       pass += name.substring(0, 1);
       return pass;
    }

    /**
    * It gives the string representation of the player under
    * decrypted password.
    * @return the player string representation.
    */
    @Override
    public String toString() {
       return "" + getName() + " $" + getAmount() + "\t" + getPassword();
    }

    /**
    * It gives the string representation of the player under
    * encrypted password.
    * @return the player string representation.
    */
    public String getEncrypted(){
       return "" + getName() + " $" + getAmount() + "\t" + encrypt...

By purchasing this solution you'll be able to access the following files:
Solution.zip and Solution.png.

$45.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats