Latest Tutorials| Questions and Answers|Ask Questions?|Site Map

Home Jsp Simple-jsp-example Sine Table in JSP

Related Tutorials


Share on Google+Share on Google+

Sine Table in JSP

There are variety of ways to define sine, cosine, etc other than the trignometric definition.

Sine Table in JSP


What is sine: There are variety of ways to define sine, cosine, etc other than the trignometric definition. They are not angles, by the way, they are the functions of angles. Many centuries ago, far too many to be certain exactly how it happened, people noticed that as long as the angles of triangles were the same, while the sides could be as long or short as you wanted, the ratios stayed the same. 

Before we proceed, its important to understand what these programs were designed to do. The main purpose of building a sine table is to create a reference table of sine values plus a fast and simple way for later program parts to retrieve sine and cosine values. Mathematically, the sine of an angle is the ratio of the length of the opposite side to the length of the hypotenuse of an imaginary right triangle having that angle in it.

To calculate the the sine we have one  function provided to calculate a sine of a function.

Here is the code of the JSP file:

<%@page import="java.util.*, java.lang.*" %> 
<head><title>Sin Table</title></head>
<h1 align="center">Sin Table</h>
<table border="1" align="center">
<%!int angles[] ={0, 30, 45, 75,90};%>
<th>Angle</th><th>Sign of Angle</th>
<% for (int i=0; i<5; i++){ %>
<tr><td><%= angles[i]%></td>
<td><%=Math.sin( Math.toRadians(angles[i]))%>
<%} %>

Output of the Program:

Download this example.


If you enjoyed this post then why not add us on Google+? Add us to your Circles

Liked it!  Share this Tutorial

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 8, 2008

Related Tutorials

Discuss: Sine Table in JSP  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image