The average person can jump off the ground with a launch velocity of 7 mph witho
ID: 3681285 • Letter: T
Question
The average person can jump off the ground with a launch velocity of 7 mph without fear of leaving the planet. However, if an astronaut jumps with this launch velocity while standing on Halley’s Comet, will the astronaut ever come back down? Create a program that allows the user to input a launch velocity (in mph) from the surface of Halley’s Comet and determine whether a jumper will return to the surface. If not, the program should calculate how much more massive the comet must be in order to return the jumper to the surface. Allow the user to continue input as long as he/she wishes. (no negative launch velocities allowed). Exponential form is acceptable.
Use at least two (2) void functions. (More the better)
Escape velocity is SQRT (2 * G * M / R) (use cmath for sqrt)
G = gravitational constant = 6.67 * 10-11 N m2/kg2
M = mass of Halley’s Comet = 1.3 * 1022 kg
R = Halley’s Comet radius = 1.153 * 106 m
Hint: The following constants can be used in your program. const double G = 6.67E-11; const double MASS = 1.3E22; const double RADIUS = 1.153E6;
SAMPLE OUTPUT:
Enter launch velocity in mph =>7
Jumper will return
Another input?, press 1=>1
Enter launch velocity in mph =>3400
Jumper would return if the mass was at least 1.99675e+22
Another input?, press 1=>1
Enter launch velocity in mph =>540
Jumper will return
Another input?, press 1=>2
Explanation / Answer
#include<iostream>
#include<cmath>
using namespace std;
// function to calculate more mass needed to remain on earth
void calculateMoreMass(double velocity, long double* M);
// defining constant
const double G = 6.67E-11;
const double MASS = 1.3E22;
const double RADIUS = 1.153E6;
int main(){
int choice = 1;
double velocity;
while(choice == 1){
cout<<"Enter launch velocity in mph =>";
cin>>velocity;
if(velocity <= 7.0){
cout<<"Jumper will return"<<endl;
}
else{
long double M ;
calculateMoreMass(velocity, &M);
cout<<"Jumper would return if the mass was at least "<<M<<endl;
}
cout<<"Another input?, press 1=>";
cin>>choice;
}
return 0;
}
void calculateMoreMass(double velocity, long double* M){
*M = ((velocity*velocity*RADIUS)/(2*G)) - MASS;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.