1
2 public class NewMain {
3
4
5 @param args
6
7 public static void main(String[] args) {
8
9
10 double myNumber1, myNumber2;
11 double squareRoot, highestValue, circleArea,randomNumber;
12
13 System.out.println("Math Class Methods");
14 System.out.println("******************\n");
15
16
17 myNumber1 = Math.round(7.5342);
18 System.out.println("7.5342 is rounded to " + myNumber1 );
19 myNumber2=Math.round(10.4999);
20 System.out.println("10.4999 is rounded to " + myNumber2 + "\n");
21
22
23 squareRoot=Math.sqrt(36);
24 System.out.println("The squareroot of 36 is " + squareRoot + "\n");
25
26
27 highestValue=Math.max(10,20);
28 System.out.println("The maximum value of 10,20 is " + highestValue + "\n");
29
30
31 circleArea=Math.round(Math.PI * Math.pow(8,2));
32 System.out.println("The area of a circle with a radius of 8 is " + circleArea + "\n");
33
34
35 randomNumber = Math.random();
36 System.out.println("The random number generated is: " + randomNumber + "\n");
37
38 }
39
40 }
41