Solved

Program to determine Falling Distance

Posted on 2009-07-15
1
1,444 Views
Last Modified: 2013-11-24
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);

		

	}

}

Open in new window

0
Comment
Question by:gkilgore
1 Comment
 
LVL 6

Accepted Solution

by:
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);

                

        }

}

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Conflicting setter definitions for property Exception 5 84
scoresClump  challenge 31 123
scoreUp challenge 14 56
wordmultiple challenge 12 116
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now