Write a script that gets from the user the radius of a circle and outputs XHTML text that displays the circle's diameter, circumference and area. Use the constant value 3.14159 for π. Use the GUI techniques shown in Fig. 6.9. [Note: You may also use the predefined constant Math.PI for the value of π. This constant is more precise than the value 3.14159. The Math object is defined by JavaScript and provides many common mathematical capabilities.] Use the following formulas (r is the radius): diameter = 2r, circumference = 2πr, area = πr 2.


<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Exercise 6.19 Circle It</title>
<script type="text/javascript">
<!--
var radius;
radius = window.prompt("Enter Radius of a circle:");
var r = parseInt(radius);
var d = 2 * r;
var circum= 2 * 3.14159 * r;
var area = Math.PI * r * r;
document.writeln( "<h1> The Diameter of a cirlce is: " + d + "</h1>" );
document.writeln("<h1> The Circumference: " + circum + "</h1>");
document.writeln("<h1> The Area of a cirlce is: " + area + "</h1>");
// -->
</script>


</head>
<body>
<p> Click Refresh(F5) or reload to run this script again</p>

</body>
</html>