How To Implement Math Class In Java
Rate this article
0 out of 5
In this tutorial we will show you how to implement math class in java. After viewing the video tutorial, download the source code and try to modify the code so as to get a feel of what is learned in this video tutorial.


Source Code
 MathClass
import java.io.*;
import java.util.*;

class MathClass
{
public static void main(String args[])
{
//Scanner data = new Scanner(System.in);
double num1,num2,num;
//System.out.println("Enter a number");
//num1=data.nextInt();
//System.out.println("Enter a number");
//num2=data.nextInt();
num1=8.00;
num2=27.00;
num=Math.abs(-2.5);
System.out.println("absolute:"+num);

num=Math.min(num1,num2);
System.out.println("min:"+num);

num=Math.max(num1,num2);
System.out.println("max:"+num);

num=Math.ceil(8.4);
System.out.println("ceil:"+num);

num=Math.floor(8.4);
System.out.println("floor:"+num);

num=Math.pow(num1, num2);
System.out.println("power:"+num);

num=Math.sqrt(num1);
System.out.println("sqrt:"+num);

num=Math.rint(num1);
System.out.println("rint :"+num);



num=Math.round(num1);
System.out.println("round :"+num);



}
}



Source Code

Joined Date : 04/02/2013
Articles
Posted
27
Messages
Posted
0


Click Here to See Full Profile
   
Author
Messages
Posted:
Post Your Comments
Name (Max 50 Chars)
Comments

 
TekTipsDownload
GateExam
Academic Projects
TekTipsExperts
Android