Javascript program: Strings and Arrays Lab

Part #1: Password Generator

Write a program to ask a user to input their name (firstname and lastname separated by a space). Then use string methods to generate a password. The password will be first three letters of the lastname followed by the first letter and last letter of the firstname. For example, “Bill Smith” would get a password of “smibl”. Use an alert box to display the password back to the user.

Part #2: Acronym Generator

Write a program that asks the user to input a phrase or a sentence. It will then create an acronym based on that input. For example, “random access memory” would become “RAM”, or “I am not a crook” would become “IANAC”. The acronym should be capitalized. Use an alert box to display the acronym back to the user.

Part #3: Numerical Array

Write a program to ask the user for three numbers and then add them to an empty array using the push() method. Then calculate the sum and average of the numbers in the array. For example, inputs of 100, 150 and 200 would give a sum of 450 and an average of 150. Use an alert box to display the sum and average back to the user.