Question: Create a javascript program: Write a function that performs a calculation. For example, here is a function that converts a length in inches into centimeters:

Create a javascript program:

  • Write a function that performs a calculation. For example, here is a function that converts a length in inches into centimeters:
    function in2cm(inches) { var cm = inches * 2.54; return cm; } 
  • Test your function. You can hardcode the input values for your function or you can use a prompt box to interactively enter the input values.
  • Show the output from your function with a prompt box or using the document.writeln method
  • Here are some examples of calculations:
    1. Convert radians to degrees, minutes, and seconds.
    2. Convert light years to parsecs.
    3. Compute the roots of a quadratic equation.
    4. Compute the wind chill, using the temperature and wind speed as inputs.
    5. Convert a course score to a course grade.
    6. For football fans: compute a passer rating using the inputs number of passing attempts, number of completions, passing yards, touchdown passes, interceptions. Find the formula on Wikipedia.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!