created 05/26/03; edited 11/09/2012, 07/09/2016

#
Chapter 42 Programming Exercises

## Exercise 1 — Log Table

Modify the program that prints out a table of `x`

and `ln(x)`

so that the table is formatted using HTML.
Do this by first printing:

<html>
<body>
<table>
<tr><th>x</th><th>ln(x)</th></tr>

Next, for each iteration of the loop,
calculate `x`

and `logx`

and print the line:

System.out.println("<tr><td>" + x + "</td><td>" + logx + "</td></tr>" );

Finally, print:

</table>
</body>
</html>

Run your program and redirect the output to
a disk file (see Chapter 21).

C:\>java LogTable > myLogs.html

You should now be able to view your output file
with a Web browser.
(Find it in your subdirectory and double click on it,
or use "File/Open" in your browser's menu.)

Click here to go back to the main menu.

## Exercise 2 — Cosine Program

Add to the `sineWave`

program so that it graphs the
sine function in red and the cosine function in blue, both
in the same drawing area.

Click here to go back to the main menu.

## Exercise 3 — Improved Graphics

Add to the `sineWave`

program that it
draws the x and y axis.
Also, draw "tick" marks along the x axis at
PI/4, PI/2, 3*PI/4, and 2*PI.
Draw axes and tick marks in black.
Draw the sine in red.

Click here to go back to the main menu.