-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMaths.java
More file actions
30 lines (28 loc) · 975 Bytes
/
Copy pathMaths.java
File metadata and controls
30 lines (28 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package JavaDev;
import java.lang.Math;
import java.util.*;
public class Maths {
static void Hypotenuse(){
Scanner input = new Scanner(System.in);
System.out.println("Input x: ");
double x = input.nextDouble();
System.out.println("Input y: ");
double y = input.nextDouble();
double answer = Math.sqrt((x*x) + (y*y));
System.out.println(String.format("The hypotenuse is %f",answer));
input.close();
}
public static void main (String args[]){
double a = 1;
double b = 2;
int c = -50;
System.out.println(Math.max(a,b));
System.out.println(Math.sqrt(Math.abs(c)));
//Hypotenuse();
Random Randinst = new Random();
int r1 = Randinst.nextInt(7) + 1;
double r2 = Randinst.nextDouble(); //between 0 and 1
boolean condition = Randinst.nextBoolean();
System.out.println(r1 + " and " + r2 + " and " + condition);
}
}