/** * Adds an application to the applications ArrayList. If index is -1, add application * to the end of applications. Else is index is within the size of applications, add * application at that index in applications. Otherwise, return. However, if applications * or application is null, return. * * @param applications * @param application * @param index */ public static void addApplication(ArrayList<String> applications, String application, int index) { // TODO: FILL IN BODY }
/** * Generates a random password of length passwordLength and adds it to the end of * passwords if index is -1, or adds it to the index of passwords if index is within the * size of passwords (similar to how the addApplication adds an application). To generate * the random password, use rand to generate a random int within the size of characters. You * can then use this int to grab the char at that index in characters and concatenate that * to your String password variable. However, if passwords is null, return. * * @param passwords * @param passwordLength * @param rand * @param index * @param characters */ public static void addPassword(ArrayList<String> passwords, int passwordLength, Random rand, int index, String characters) { // TODO: FILL IN BODY }
/** * Removes a password from your password storage parallel ArrayLists. To do this, remove the * first instance (starting from index 0 of applications) of application in applications. Then * remove its corresponding password in passwords. If there are duplicate application/password * pairs (ie two Facebook passwords) you should only remove the first instance. However, if * applications or passwords are null, return. * * @param applications * @param passwords * @param application */ public static void removePassword(ArrayList<String> applications, ArrayList<String> passwords, String application) { // TODO: FILL IN BODY }
/** * Generates a String with a display message for your applications and passwords, * where the passwords are in star notation (every character in the password is * replaced with '*'). The start of your message should be "Your Passwords:\n". * Return "You do not have any passwords in storage!\n" if applications is null or * empty or passwords is null or empty. * Note: your generated String should end with a single '\n'. * Example: * Your Passwords: * Canvas: ******** * Piazza: ************* * * @param applications * @param passwords * @return the display message */ public static String getDisplayString(ArrayList<String> applications, ArrayList<String> passwords) { // TODO: FILL IN BODY }
public static void main(String[] args) { // TODO: FILL IN BODY } }
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.