Solved

# Program to determine Falling Distance

Posted on 2009-07-15
1,435 Views
I've gone blank on writing this program. Any assistance will be greatly appreciated.
Java program will determine the distance an object falls within a specfic time period.  time should be displayed using seconds.  the given formula is: d= 1/2 gt2. Return the distance, in meters, and use values 1 thru 10 as arguments.  Here's what I have thus far, but a long way from where I should be, I think.
``````import java.util.Scanner;

public class Distance

{

public static void main(String args[])

{

double kilOmeters = 0;

double time = 0;

double speed = 0;

String input;

java.util.Scanner UserInput = new java.util.Scanner(System.in);

System.out.println("Enter Km: ");

kilOmeters=UserInput.nextDouble();

time = kilOmeters/60;

System.out.println("Time seconds = " + time);

}

}
``````
0
Question by:gkilgore
1 Comment

LVL 6

Accepted Solution

Ravi Kalla earned 500 total points
ID: 24862823
below is the code for your requirement
``````import java.util.Scanner;

public class Distance

{

public static void main(String args[])

{

double meters = 0;

double time = 0;

double gravity = 0;

String input;

java.util.Scanner UserInput = new java.util.Scanner(System.in);

System.out.println("Enter Time: ");

time=UserInput.nextDouble();

System.out.println("Enter Gravity: ");

gravity=UserInput.nextDouble();

meters = 0.5 * gravity * time * time;

System.out.println("Distance = " + meters);

}

}
``````
0

## Featured Post

### Suggested Solutions

Help refactoring a java code 8 54
maxMirror challenge 10 89
countAbc challenge 9 50
wordappend challenge 8 86
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be \$37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.