If you fire a projectile fast enough, the curve of the earth will match the spee
ID: 2247010 • Letter: I
Question
If you fire a projectile fast enough, the curve of the earth will match the speed at which the projective falls. The projectile will then orbit the earth. The speed, in meters/second necessary to orbit the earth at an altitude h can be calculated by velocity = Squareroot G Me /R + h where: G is the universal gravitation constant, 6.67408 times 10^-11 (written 6.67408e-1 1 in Java) Me is the mass of the earth, 5972 times 10^24 Kg R is the radius of the earth, 6.371 times 10^6 meters h is the height of the orbiting object in meters Write a program that asks the user the altitude of an obit in kilometers and then displays the velocity in meters/second. Note that there are 1000 meters in a kilometer. You will have to convert the input from kilometers to meters. Sample input and output Enter the orbit altitude in Km 225 The orbit speed is 7773.476322849655 m/s Most people in America are more familiar with miles than meters. Modify your program to input the altitude in miles and display the result in miles/hour. There are 1.60934 kilometers in a mile and 2.23694 miles/hour in one meter/second. Convert the input from miles to km and the result of the calculation from m/s to mph.Explanation / Answer
Solution of 2A :
import java.util.Scanner; //to use Scanner class
import java.lang.Math; //to use Math class which contains sqrt() and pow() functions
class Velocity
{
public static void main(String args[])
{
Scanner obj=new Scanner(System.in);
double G=6.67408e-11;
double Me=5.972*Math.pow(10,24); //using pow() of Math class
double R=6.371*Math.pow(10,6); //using pow() of Math class
double h,velocity;
System.out.println("Enter the orbit altitude in Km");
h=obj.nextDouble(); //using nextDouble() of Scanner class
h=1000*h;
velocity=Math.sqrt((G*Me)/(R+h)); //using sqrt() of Math class
System.out.println("The orbit speed is "+velocity+" m/s");
}
}
Solution of 2A :
import java.util.Scanner; //to use Scanner class
import java.lang.Math; //to use Math class which contains sqrt() and pow() functions
class VelocityInMilesPerHour
{
public static void main(String args[])
{
Scanner obj=new Scanner(System.in);
double G=6.67408e-11;
double Me=5.972*Math.pow(10,24); //using pow() of Math class
double R=6.371*Math.pow(10,6); //using pow() of Math class
double h,velocity;
System.out.println("Enter the orbit altitude in miles");
h=obj.nextDouble(); //using nextDouble() of Scanner class
h=1000*1.60934*h; //1000 is using to convert km into metre
velocity=Math.sqrt((G*Me)/(R+h)); //using sqrt() of Math class
velocity=velocity*2.23694; //converting m/s into miles/hour
System.out.println("The orbit speed is "+velocity+" miles/hour");
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.