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 secon

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/12 10:51:43
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 secon

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 secon
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

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 secon
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 < 0);
System.out.println("The object is at " + (100 - 4.9 * time * time)
+ " meter!");
}
}