Intro to internet applications com-340-dl01 programming exercise 4

8.6 Write a script that finds the smallest of several nonnegative integers. Assume that the first

value read specifies the number of values to be input from the user.

8.8 Modify the compound interest program in Fig. 8.6 to repeat its steps for interest rates of 5, 6,

7, 8, 9 and 10 percent. Use a for statement to vary the interest rate. Use a separate table for each rate.

9.7 Write a script that uses a form to get the radius of a circle from the user, then calls the function

circleArea to calculate the area of the circle and display the result in a paragraph on the page.

To get the number from the form, use the techniques shown in Self-Review Exercise 9.6 below.

 

 

9.17 Implement the following functions:

a) Function celsius returns the Celsius equivalent of a Fahrenheit temperature, using the calculation                      C = 5.0 / 9.0 * ( F – 32 );

 

b) Function fahrenheit returns the Fahrenheit equivalent of a Celsius temperature, using the calculation                F = 9.0 / 5.0 * C + 32;

 

c) Use these functions to write a script that enables the user to enter either a Fahrenheit or a Celsius temperature and displays the Celsius or Fahrenheit equivalent.

 

Your HTML5 document should contain two buttons—one to initiate the conversion from Fahrenheit to Celsius and one to initiate the conversion from Celsius to Fahrenheit.

Leave a Reply