Title:                          "Letter to Santa project"

Specifications:
1. Upon the page loading the user should be prompted a message (in a question <div> tag) asking for their name.  A header and two buttons should be present, one with a value of “Set Name” and the other with a value of “Create Santa’s Letter”.
2. After the user click’s the “Set Name” button a brief message welcoming the user by name should appear in a separate output <div> tag below the buttons.  The question <div> tag should be changed to ask what item they would like to add to their list.  The “Set Name” button should be replaced with a button saying “Add Item” with a new onClick event handler.
3. The user should be able to type an item in the text box and click the “Add Item” button to add it to an array.  After selecting the button, the text box’s value should be reset to an empty String and the message “You have added (item) to your Christmas List!” should appear in the output <div>.
4. At any point in time the user should be able to select the “Create Santa’s Letter” button.  When this is done, a descriptive message should be displayed in the output <div> listing all items currently in the array.  The message should be formatted in the following way:
 
 Dear Santa,
 
 I would like the following (# of items) items for Christmas this year:
 
  Item #1 Item #2  (etc.)
 
 Thank you for your consideration Santa!
 
  The best kid ever, (name)
 
5. After five (5) items have been entered, Santa’s letter should be automatically generated.  The message should be formatted in the following way:
 
 Dear Santa,
 
 I would like the following (# of items) items for Christmas this year:
 
  Item #1  …  Item #5
 
  Since I am greedy and asked for 5 things, my one favorite item is: (randomly chosen item)
 
  The best kid ever, (name)
 
 The ‘randomly chosen item’ is picked via a randomly generated number corresponding to an index within the range of your five (5) items in the array. 
 
Category:
Computer Science

Sub-Category:
Programming

Project Description:
Programmed to Accept items from a user and generate a letter to Santa.

Tools:
HTML, JS and CSS.

Platforms: 
Windows

Things I learned:
Learned how to use an Array in programming  logic.
Learned how to Programmatically code for different scenarios.
Learned how to Programmatically track variables and values for different scenarios and display them at an appropriate place.
Learned how to code a reusable function.
Learned how to code for creating a custom button and change the characteristics.
Learned how to code for Standard HTML elements (a title, a header, buttons, and <div> elements).
Learned how to document code comments (including a comment before each function, code citations when appropriate, and citations for any images used).

Contribution: 
Individual.

Credits:
Mr. Charles B. Nichols, AP Computer Science Teacher.


Letter to Santa
Published:

Letter to Santa

Letter to Santa accept items from a user and generate a letter to Santa.

Published: