-
Notifications
You must be signed in to change notification settings - Fork 0
/
fallingobject
42 lines (28 loc) · 958 Bytes
/
fallingobject
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
31
32
33
34
35
36
37
38
39
40
41
42
package fallingobject;
/* English Description
/*This program computes the distance that an object will fall under Earth's
gravity . Using the equation x(t) = 0.5 *at^2 +vt +x.
The variables are a= -9.8 , t = 15, v = 0, and x= 0.
The variables are casted as doubles and variable z
is declared as the final value of z = 0.5 * a*(t*t) + (v*t)+x;
Then z is printed out as "The object falls under Earth's
gravity as:"+ z. /*
/**
*
* @author Home
*/
public class FallingObject {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
double a = -9.8;
double t = 15;
double v = 0;
double x = 0;
double z = 0;
z = 0.5 * a*(t*t) + (v*t)+x;
System.out.println("The object falls under Earth's gravity "
+ "at :" + z);
}
}