-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMain.java
More file actions
29 lines (21 loc) · 823 Bytes
/
Main.java
File metadata and controls
29 lines (21 loc) · 823 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
package FloatAndDouble;
public class Main {
public static void main(String[] args) {
//width of int = 32 (4 bytes)
int myIntValue = 5 / 3;
//width of float = 32 (4 bytes)
float myFloatValue = 5f / 3;
//width of double = 62 (8 bytes)
double myDoubleValue = 5d / 3;
/*
System.out.println("My Int Value = " + myIntValue);
System.out.println("My Float Value = " + myFloatValue);
System.out.println("My Double Value = " + myDoubleValue);
*/
//Challenge
double myValuePounds = 200d;
double kilograms = 0.45359237d;
double calculation = myValuePounds * kilograms;
System.out.print(myValuePounds + " pounds is equal to " + calculation + " kilograms.");
}
}