-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGhz.java
More file actions
30 lines (21 loc) · 740 Bytes
/
Copy pathGhz.java
File metadata and controls
30 lines (21 loc) · 740 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
// library for the scannner
import java.util.Scanner;
import java.util.Arrays;
public class Ghz {
public static void main(String[] args){
System.out.println(Arrays.toString(args));
//Initialise a Scanner to road Fromm the commmand line
Scanner in = new Scanner(System.in);
//Tell the user what you want
System.out.println(" Please give the clock speed of your computer " );
// Collect the input
double clockSpeed = in.nextDouble();
clockSpeed= clockSpeed * Math.pow(10,9);
//speed of light
final double speedOfLight = 299792.458;
//calculus
double lightDistance = speedOfLight / clockSpeed;
// print the answer
System.out.println( " this the amount of kilometers travelled " + lightDistance );
}
}