Project Outcomes:

Write a JavaScript program that uses:

  • Objects to represent data
  • Methods to calculate data
  • Functions to display data on a webpage
  • If statements to validate data

Project Requirements:

1.The UWF Men's Basketball Team has asked you to create a web app that helps a player quickly calculate their free throw shooting percentage. A previous developer has begin working on the solution, but you must take their code and complete it. HTML and CSS files have been provided for you, along with a partial JS file.

2.The user is presented with a form that asks them to enter their jersey number, their number of completions and the number of attempts. When they hit the submit button, the program will compute the player's free throw percentage and display it along with their jersey number on the right of the screen.

3. After the form is submitted, your program must create a JavaScript object to represent the player. The object must have properties to contain their jersey number, their shooting attempts, and shooting completions. The object must also contain a method that calculates the players free throw shooting percentage. Here's the formula: Math.round(completed / attempts * 100)

4.You must then create a function called showResults() that takes this student object as an argument and displays the results on the screen in the div with id="results". The example below uses this HTML: "< h4>Freethrow Percentage for #23: 94%". The shooting percentage must be rounded to the nearest whole number (see formula above and screenshot below) with a percent symbol.

5.If the student completions is greater than the number of attempts, display an error message instead. see image.

6. Further develop the program so that it can store a series of student objects in an array. Then, pass the array to the showResults() function and display the entire contents of the array along with the team's combined free throw shooting percentage. In other words, add up all the completions made by the team and divide it by the number of attempts made. In this example, each player is an item in an unordered list. see image.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.