Gravity Fall

 Gravity Fall

Problem Description


Create a program that determines how quickly an object is traveling when it hits the ground. The user will enter the height from which the object is dropped in meters (m). Because the object is dropped its initial speed is 0m/s. Assume that the acceleration due to gravity is 9.8m/s. You can use the formula vf =squareroot(vi+2ad)to compute the final speed, vf , when the initial speed, vi , acceleration, a, and distance, d, are known.


Solution.


import java.util.Scanner;

import java.io.*;

public class TestClass {

public static void main(String[] args) { 

Scanner sc= new Scanner(System.in); 

       int a= sc.nextInt();

double b= Math.sqrt(2*9.8*a);

String V= String.format ("%,.2f",b);       

System.out.println("The object will hit the ground at "+V+" m/s");

     }

}


Post a Comment

0 Comments