Monday, 22 February 2016

Java Tutorial : Java Math class (Trigonometric methods)


Click here to watch in Youtube :
https://www.youtube.com/watch?v=hBvEhNbd6zk&list=UUhwKlOVR041tngjerWxVccw

Click the below Image to Enlarge
Java Tutorial : Java Math class (Trigonometric methods) 
MathDemo.java
public class MathDemo
{

    public static void main(String[] args)
    {

        double degrees = 25.0;
        double radians = Math.toRadians(degrees);

        System.out.format("The value of pi " + "is %.4f%n", Math.PI);

        System.out.format("The sine of %.1f " + "degrees is %.4f%n",
                degrees, Math.sin(radians));

        System.out.format(
                "The cosine of %.1f " + "degrees is %.4f%n", degrees,
                Math.cos(radians));

        System.out.format("The tangent of %.1f "
                + "degrees is %.4f%n", degrees, Math.tan(radians));

        System.out.format("The arcsine of %.4f "
                + "is %.4f degrees %n", Math.sin(radians),
                Math.toDegrees(Math.asin(Math.sin(radians))));

        System.out.format("The arccosine of %.4f "
                + "is %.4f degrees %n", Math.cos(radians),
                Math.toDegrees(Math.acos(Math.cos(radians))));

        System.out.format("The arctangent of %.4f "
                + "is %.4f degrees %n", Math.tan(radians),
                Math.toDegrees(Math.atan(Math.tan(radians))));
    }
}
Output
The value of pi is 3.1416
The sine of 25.0 degrees is 0.4226
The cosine of 25.0 degrees is 0.9063
The tangent of 25.0 degrees is 0.4663
The arcsine of 0.4226 is 25.0000 degrees 
The arccosine of 0.9063 is 25.0000 degrees 
The arctangent of 0.4663 is 25.0000 degrees 
Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/MathDemo_Trigonometric_App.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/MathDemo_Trigonometric_App

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/d0559102086f9677d57877fbba43556aca45fc19/BasicJava/MathDemo_Trigonometric_App/?at=master

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment