how to write this java programthe question is:The height of an object dropped from a starting height of 100 meters is govern by the equation h=100-4.9*t^2 where t is the time in seconds.Write a program that asks the user for a time less than 20 seconds and displays the height of the object at that time using this formula.The output should look similar to:Enter the time:2The object is at 80.4 meterim in usa·this is my computer homework·i cannot type in

问题描述:

how to write this java program
the question is:The height of an object dropped from a starting height of 100 meters is govern by the equation h=100-4.9*t^2 where t is the time in seconds.Write a program that asks the user for a time less than 20 seconds and displays the height of the object at that time using this formula.The output should look similar to:
Enter the time:2
The object is at 80.4 meter
im in usa·this is my computer homework·i cannot type in Chinese·sorry

hi,here is my program.
it is my pleasure to help u!
import java.util.Scanner;
public class App {
/**
* @param args
*/
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int time = 0;
do {
System.out.println("Please input a time less than 20 seconds!");
time = s.nextInt();
} while (time >= 20 || time System.out.println("The object is at " + (100 - 4.9 * time * time)
+ " meter!");
}
}