Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ch4ex1;
- import java.util.Scanner;
- public class Ch4Ex1
- {
- public static void main(String[] args)
- {
- Scanner sc=new Scanner(System.in);
- System.out.print("Enter a time less than 4.5 seconds: ");
- double s=sc.nextDouble();
- while(s>4.5)
- {
- System.out.print("Invalid number. Please enter a time less than 4.5 seconds: ");
- s=sc.nextDouble();
- }
- double h=100-4.9*(s*s);
- System.out.println("The height of the object is: "+h);
- }
- }
Add Comment
Please, Sign In to add comment