Background We are going to estimate the length of time that passes for astronaut
ID: 3542256 • Letter: B
Question
Background
We are going to estimate the length of time that passes for astronauts as they travel at near light speeds. You may remember that time passes more slowly for the astronauts on ship than those on earth as the ship approaches the speed of light. You may also remember that the mass of the ship also increases as it approaches light speed (which, therefore, is an estimate of how much more energy much be expended as you approach light speed). You may remember that Einstein wrote a simple equation that provides a factor indicating the change in time and mass based on speed, which is:
where v is velocity and c is the velocity of the speed of light, which is well approximated at 299,792,458 meters/second. The factor calculated is how much time is reduced by and how much mass is increased by. For example, at 149,896,229 meters per second (half the speed of light) the factor is 1.1547005383792517.
Times(Alpha Centauri, Barnard's Star, Betelgeuse, Andromeda Galaxy) are reduced by the factor (division)
The mass (weight) is increased by the factor(multiplication).
Program Specifications
Your program will prompt the user for a floating point number representing percentage of the speed of light your ship will travel. Your program then prints the following information:
Please enter velocity (percentage of speed of light): 0 Ship is traveling at 0 % of the speed of light. At this speed: Weight of the shuttle is 70000.0 . Perceived time to travel to Alpha Centauri 4.3 years. Perceived time to travel to Barnard's Star is 6.0 years. Perceived time to travel to Betelguese is 309.0 years. Perceived time to travel to Andromeda Galaxy is 2000000.0 years. Please enter velocity (percentage of speed of light): 50 Ship is traveling at 50 % of the speed of light. At this speed: Weight of the shuttle is 80829.0376865 . Perceived time to travel to Alpha Centauri 3.72390923627 years. Perceived time to travel to Barnard's Star is 5.19615242271 years. Perceived time to travel to Betelguese is 267.601849769 years. Perceived time to travel to Andromeda Galaxy is 1732050.80757 years.Explanation / Answer
import java.util.*;
public class shuttle
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Please enter velocity (perecentage of speed of light) :");
double vel = in.nextDouble();
double weight = 70000.0;
double factor = 1/(Math.sqrt(1-(vel/100)*(vel/100)));
System.out.println("Ship is travelling at "+ vel + " % of the speed of light");
System.out.println("");
System.out.println("At this speed :");
System.out.println("Weight of shuttle is "+weight*factor);
System.out.println("Perceived time to travel to Alpha Centauri is " + (4.3/factor) + " years");
System.out.println("Perceived time to travel to Barnard's star is " + (6.0/factor) + " years");
System.out.println("Perceived time to travel to Betelguese is " + (309.0/factor) + " years");
System.out.println("Perceived time to travel to Andormeda Galaxy is " + (2000000/factor) + " years");
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.