|
<script>
//Rectangle Calculator
//by Norman Duong
//09-23-07
var heightR="";
var widthR="";
alert("This program will help you calculate for the area and perimeter");
heightR=prompt("How many units is the height of the rectangle?");
widthR=prompt("How many units is the width?");
alert("So the height is " +heightR+ " and the width is " +widthR+ ", correct?");
alert("I'm going to calculate the perimeter and area!");
heightR=eval(heightR);
widthR=eval(widthR);
perim=(2*(heightR+widthR));
area=heightR * widthR;
alert("As a result of calculating for the perimeter and area, here are my results,");
alert("The perimeter is "+perim+" units");
alert("The area is "+area+" units");
</script>
|
|