Write a script that tests whether the examples of the Math method calls shown in Fig. 18.1 actually produce the indicated results.

What will be an ideal response?


```
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <!-- ex18_02.html -->
3
4 <HTML>
5
6 <HEAD>
7 <TITLE>Solution: 18.2</TITLE>
8
9 <SCRIPT LANGUAGE = "JavaScript">
10 document.writeln( "Math.abs( 23.7 ) = " + Math.abs( 23.7 ) );
11 document.writeln( "<BR>Math.abs( 0.0 ) = " + Math.abs( 0.0 ) );
12 document.writeln( "<BR>Math.abs( -23.7 ) = " + Math.abs( -23.7 ) );
13 document.writeln( "<BR>Math.ceil( 9.2 ) = " + Math.ceil( 9.2 ) );
14 document.writeln( "<BR>Math.ceil( -9.8 ) = " + Math.ceil( -9.8 ) );
15 document.writeln( "<BR>Math.cos( 0.0 ) = " + Math.cos( 0.0 ) );
16 document.writeln( "<BR>Math.exp( 1.0 ) = " + Math.exp( 1.0 ) );
17 document.writeln( "<BR>Math.exp( 2.0 ) = " + Math.exp( 2.0 ) );
18 document.writeln( "<BR>Math.floor( 9.2 ) = " + Math.floor( 9.2 ) );
19 document.writeln( "<BR>Math.floor( -9.8 ) = " + Math.floor( -9.8 ) );
20 document.writeln( "<BR>Math.log( 2.718282 ) = " + Math.log( 2.718282 ) );
21 document.writeln( "<BR>Math.log( 7.389056 ) = " + Math.log( 7.389056 ) );
22 document.writeln( "<BR>Math.max( 2.3, 12.7 ) = " + Math.max( 2.3, 12.7 ) );
23 document.writeln( "<BR>Math.max( -2.3, -12.7 ) = " + Math.max( -2.3, -12.7 ) );
24 document.writeln( "<BR>Math.min( 2.3, 12.7 ) = " + Math.min( 2.3, 12.7 ) );
25 document.writeln( "<BR>Math.min( -2.3, -12.7 ) = " + Math.min( -2.3, -12.7 ) );
26 document.writeln( "<BR>Math.pow( 2, 7 ) = " + Math.pow( 2, 7 ) );
27 document.writeln( "<BR>Math.pow( 9, .5 ) = " + Math.pow( 9, .5 ) );
28 document.writeln( "<BR>Math.round( 9.75 ) = " + Math.round( 9.75 ) );
29 document.writeln( "<BR>Math.round( 9.25 ) = " + Math.round( 9.25 ) );
30 document.writeln( "<BR>Math.sin( 0.0 ) = " + Math.sin( 0.0 ) );
31 document.writeln( "<BR>Math.sqrt( 900.0 ) = " + Math.sqrt( 900.0 ) );
32 document.writeln( "<BR>Math.sqrt( 9.0 ) = " + Math.sqrt( 9.0 ) );
33 document.writeln( "<BR>Math.tan( 0.0 ) = " + Math.tan( 0.0 ) );
34 </SCRIPT>
35 </HEAD>
36
37 <BODY>
38 </BODY>
39 </HTML>
```

Computer Science & Information Technology

You might also like to view...

A(n) ________ is two letters that are fashioned together into a single character

A) ligature B) style C) alignment D) font

Computer Science & Information Technology

In declaring and initializing a string variable for use in an open() method, the string is considered a ____.

a. string object b. C-string c. c_str d. c-character

Computer Science & Information Technology

Where does an application look when figuring out whether or not it can open a file, and how to manage the file, when asked by a user to open it?

a. It looks at the extension. b. It goes straight to the EOF marker, where the file identifier is located. c. The information is stored in the $MFT file. d. It reads the file header.

Computer Science & Information Technology

____ is an extra array used during the merge process.

A. mergeSortHelper B. tempSpace C. copyBuffer D. mergeBuffer

Computer Science & Information Technology