Javascript project
Activity: Functions OVERVIEW: For this assignment, you will create an application that will return either Powerball numbers or Florida lottery numbers based on the prompt value entered by the user. You will also be responsible for creating a flowchart that reflects the logic of the code you create.
LEVEL OF EFFORT: This activity should take approximately 240m to complete. It will require:
• 0m Research • 15m Prep & Delivery • 225m Work
If you find that this activity takes you significantly less or more time than this estimate, please contact me for guidance. READING & RESOURCES: Instructional Functions -‐ Rubric (necessary) This rubric outlines the points for the assignment. Make sure you check off each one as done before submitting your assignment. OBJECTIVES: Successful completion of this activity will show that you can do the following:
• Identify reusability of code within functions. • Use arguments, parameters, and returned values to pass data between functions and
main code. • Organize code into reusable blocks with functions. • Construct parameters to pass data between functions and the main document.
INSTRUCTIONS: 1. Before you begin, you should read the rubric. This is extremely important, as it will tell
you exactly how this assignment will be graded.
2. In your class folder, within your repository, create a folder called Lastname_Firstname_Functions_Assignment.
3. Brainstorm how to find and return a group of random numbers. You also need to consider that your function must return either Powerball or regular Florida lottery numbers but not both. Keep in mind that your final project must contain the following:
a. At least one function. b. Any functions created must use arguments and parameters. c. A value must be returned for each function. d. You must not use “main code” variable inside of a function; you must pass values
in as arguments and out as returned values. e. All user prompts must be validated using a while loop.
4. Using the flowcharting skills learned in Homework #1, create a detailed flowchart for
your process. Save this as a PDF into your Functions Assignment folder and commit it to your GitHub Repo. Name this file Lastname_Firstname_Functions_Flowcart.pdf
5. Once your flowchart is created, make sure you follow the organization mentioned in the videos to create an HTML file, and a js folder with a js file inside of the Functions_Assignment folder.
a. Place comments at the top of the JavaScript file that contain your name, class and term, and the assignment.
b. Following your flowchart, write your code to match. Make sure to comment every line so that you are explaining exactly what you are trying to do.
c. Continuously commit your files to your GitHub repo throughout the development process. You should have a minimum of 5 meaningful commits for this assignment.
d. Your code should give the user meaningful output. So, after you have gathered the numbers, your code should report back to the user the final values with a console.log(). If your function returns the numbers for the Powerball, remember that the output should indicate that the last number is the Powerball.
e.g. console.log(“The numbers are … and the Powerball is …”); e. After your code is complete, make sure you test your final files. Try typing in
different values to see what you get. Make sure it returns the correct number of random number based on the prompt. Put the numbers returned in a multi-‐ lined comment at the bottom of your js file.
e.g. /* Powerball numbers: 24, 56, 12, 5, 7 with PB 34 FL lottery numbers: 12, 6, 45, 87, 23 */
6. Please note that you are not required to do your flowchart first. That is, you may
complete your code and then create your flowchart. You may also choose to create your flowchart at the same time you’re creating your code. The important thing to remember is that logic of your flowchart must match the logic of your code and vice versa.
CRITERIA: Make sure your project follows this list of criteria:
• You will need to create code that returns random numbers for each group of lottery numbers.
• Keep in mind that the regular Florida lottery has six random numbers between 1 and 53; the Powerball lottery has five random numbers between 1 and 59 and a Powerball between 1 and 35.
• Each random number must be different; a lottery will never have two of the same number unless it is the final Powerball number.
• You should have at least one prompt to ask the user if they want the numbers for the Florida lottery or for the Powerball lottery.
o Each prompt should be validated using a while loop. • The result should appear in the browser's console and include an explanation of the
result. o Good example of console.log: The volume of the sphere is 26 feet cubed. o Bad example of console.log: 26
• Final output should use string concatenation. • Comment every line of code (describe what each line is doing in English). Do NOT just
label sections of your code. • Your code must contain at least one function • Each function must use arguments and parameters. • A value must be returned for every function you create. • You must not use global (“main code”) variables inside of a function; you must pass
them in as arguments.
TURNING IT IN:
• Double-‐check that you’ve commented your code (you can’t comment too much). • Commit and push your files to your GitHub repository. • Compress your Lastname_Firstname_Functions_Assignment folder into one zipped file.
It should be named Lastname_Firstname_Functions_Assignment.zip • Upload this zipped file to FSO. NOTE: This file is only used as a backup file. Everything
will be graded based on the files pushed to your GitHub repository. • IMPORTANT: If your code is not in your GitHub repository, it will result in a 0 for the
assignment. DON’T FORGET:
• Test your code. Verify that you are getting random numbers and that they do not repeat within each group of numbers
• You should have a minimum of 5 commits in your GitHub repository.
Rubric: Week 4 Scalable Data Infrastructures Bare Minimum Requirements! These requirements must be satisfied before any points are awarded. Failure to meet these requirements will result in a zero (0) grade.! 1. Working JavaScript file with no major syntax errors.! 2. HTML file with working script link to the JS file.!!
Topic % Excellent (100%) Good (75%) Fair (30%) Poor (0%)
Coding Requirements
Functions 15 At least one function is present in your code and working perfectly.
At least one function in your code but requires minor tweaks to work properly.
No functions are present or they are not working.
Arguments & Parameters
15 Arguments and parameters are present and working in every function.
Arguments and parameters are present but need minor tweaks to work correctly.
Unable to demonstrate understanding of arguments and parameters.
Return Values 10 Return values are present and working in every function.
Return values are present in each function but need minor tweaks.
Values are returned but not saved in variables.
Functions do not use return values.
Scope 10 Main code variables are not use inside of the functions Main code variables are used inside of the functions.
Syntax 10 There are no syntax errors, and syntax conforms to the style taught.
Nonconformant syntax or up to two syntax errors.
Up to five minor syntax errors. Clear problems with syntax.
Flowchart Requirements
Completeness 10 All required elements are present, of the correct type, and are used correctly.
Up to two mistyped or missing elements or minor sequence problems.
Up to five minor element problems.
Clear problems with flowchart elements.
Logic 10 Flowchart accurately portrays the code and story.
Up to two minor variances from the story or code.
Up to five minor variances form the story or code.
Flowchart seems unrelated to the code.
Support Details 10 Supporting details are present, clear, and well placed to support the flowchart.
Up to two missed support details (assumptions) or minor placement problems.
Up to five missed or misplaced support details.
Flowchart has little or no supporting details.
Professionalism Requirements
Completeness 5 All required elements from the assignment are included.
One or two minor elements missing. Major pieces of the assignment are missing.
Project is not even close to complete.
Investment 5 Presentation is well thought out, coherent, and solves the problem presented. Lackluster attempt to solve the problem presented.
Little work has been attempted.
Your course Professionalism grade is affected by your Investment grade.
- SDI_Functions_Assignment
- SDI-Week-4-Rubric