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:
- Convert radians to degrees, minutes, and seconds.
- Convert light years to parsecs.
- Compute the roots of a quadratic equation.
- Compute the wind chill, using the temperature and wind speed as inputs.
- Convert a course score to a course grade.
- 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
