Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment Requirements In order for an object to escape a planet's gravitational pull, it must attain a minimum initial velocity called the escape velocity. The
Assignment Requirements In order for an object to escape a planet's gravitational pull, it must attain a minimum initial velocity called the escape velocity. The escape velocity varies from planet to planet but it is the same for all objects on a given planet. Assume that we are analyzing the data that a small probe has collected while exploring some mystery planet. The probe has managed to obtain the circumference of the planet and the acceleration due to gravity at the surface. The probe must now determine what initial velocity it requires for takeoff in order to remove itself from the planet's gravitational force. You are to create a Java program that will determine this velocity. Your program should first prompt the user for the circumference of the planet and then the acceleration due to gravity on the planet. From this information your program should determine the radius, mass, and escape velocity of the planet using the following equations: i'EGm ,3\" l'. = l m = V r G In these equations: - ve (m/s) escape velocity m (kg) is the planet's mass, r (km) is the planet's radius, . G is the gravitational constant approximated by 6.6726 x 10'11 m3 / (kg 32) . a (m/sz) is the acceleration due to gravity on the surface of the planet. Assume that the planet is perfectly spherical. The values for circumference (c = 2rlr) of the planet and the acceleration due to gravity will be entered by the user. The gravitational constant must be declared using exponential notation. Using the relation between the circumference and radius, you can calculate the radius based on a given circumference. The calculated values must be stored in variables of appropriate type for each result of the calculation. The results must be printed using full sentences describing the calculations and the values. Numeric values in the output must be formatted to one floating point. The gravitational constant must be declared and assigned the value using exponential notation (not as mathematical expression). Example of Interaction and 0utp_ut The following are three examples of different program executions using the data for planets Earth, Mars and Moon. Program Prompts are in blue, User Input is in red, Program Output is in bold black. Planet name: Earth Circumference (km) of planet? 38000 Acceleration due to gravity (m/s'Z) on planet? 9.81 Radius of Earth: 6,047.9 Mass of Earth: 5.4e+18 Escape velocity of Earth: 344.5 Planet name: Mars circumference (km) of planet? 21344 Acceleration due to gravity (m/s'Z) on planet? 3.7 Radius of Mars: 3,397.0 Mass of Mars: 6.4e+17 Escape velocity of Mars: 158.5 Planet name: Moon Circumference (km) of planet? 3474 Acceleration due to gravity (m/s'Z) on planet? 1.62 Radius of Moon: 552.9 Mass of Moon: 7.4e+15 Escape velocity of Moon: 42.3 Your program must use the printf() method with a correct formatting pattern to prompt for input and print the output as exactly as shown in the examples above, including the indentations. The parameters inside printf method must not contain spaces for the line-up; the formatting pattern must do the line-up. Values entered will have the same indentation; likewise the numbers resulting from the calculations must be formatted and indented as shown
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started