HERE IS THE FORMAT YOU MUST USE FOR HW #2 - NOTE THE IF ELSE IF...not IF IF IF
HW #2 Format :
#include <iostream>
#include <math.h>
using namespace std;
int main() {
cout<<"Welcome to INTERPLANETARY TRAVEL PROGRAM!\nThis program enable you to fiind out your travel time t the planet you want to travel to as well as your weight on there. \nPlease enjoy the program and hope you'll find the perfect planet for you!"<<endl;
cout<<"INTERPLANETARY TRAVEL MENU"<<endl;
cout<<"----------------------------"<<endl;
cout<<"a) Mercury\nb) Venus\nc) Earth\nd) Mars\ne) Jupiter\nf) Saturn\ng) Uranus\nh) Neptune\nq) Quit"<<endl;
cout<<"Select a planet to travel to or q to quit the program: "<<endl;
string planetName;
double weight, speed, surfGrav, distSun, hours, min, sec;
double distSunEarth = 93;
char selection;
cin>>selection;
if(selection >= 'a' && selection <= 'h'){
double newWeight, distBetweenPlanets, travelTime;
if(selection == 'a'){
planetName = "Mercury";
surfGrav = 0.27;
distSun = 36;
cout<<"your weight";
cin>>weight;
cout<<"Speed(miles per hour)";
cin>>speed;
newWeight = weight * surfGrav;
distBetweenPlanets = abs(distSunEarth - distSun);
travelTime = distBetweenPlanets * 1000000 / speed;
}else if(selection == 'b'){
planetName = "Venus";
surfGrav = 0.86;
distSun = 67;
cout<<"your weight";
cin>>weight;
cout<<"Speed(miles per hour)";
cin>>speed;
newWeight = weight * surfGrav;
distBetweenPlanets = abs(distSunEarth - distSun);
travelTime = distBetweenPlanets * 1000000 / speed;
}else if(selection == 'c'){
planetName = "Earth";
surfGrav = 93;
distSun = 1.00;
cout<<"your weight";
cin>>weight;
cout<<"Speed(miles per hour)";
cin>>speed;
newWeight = weight * surfGrav;
distBetweenPlanets = abs(distSunEarth - distSun);
travelTime = distBetweenPlanets * 1000000 / speed;
} else if(selection == 'd'){
planetName = "Mars";
surfGrav = 0.37;
distSun = 141;
cout<<"your weight";
cin>>weight;
cout<<"Speed(miles per hour)";
cin>>speed;
newWeight = weight * surfGrav;
distBetweenPlanets = abs(distSunEarth - distSun);
travelTime = distBetweenPlanets * 1000000 / speed;
}else if(selection == 'e'){
planetName = "Jupiter";
surfGrav = 483;
distSun = 2.64;
cout<<"your weight";
cin>>weight;
cout<<"Speed(miles per hour)";
cin>>speed;
newWeight = weight * surfGrav;
distBetweenPlanets = abs(distSunEarth - distSun);
travelTime = distBetweenPlanets * 1000000 / speed;
} else if(selection == 'f'){
planetName = "Saturn";
surfGrav = 1.17;
distSun = 886;
cout<<"your weight";
cin>>weight;
cout<<"Speed(miles per hour)";
cin>>speed;
newWeight = weight * surfGrav;
distBetweenPlanets = abs(distSunEarth - distSun);
travelTime = distBetweenPlanets * 1000000 / speed;
} else if(selection == 'g'){
planetName = "Uranus";
surfGrav = 0.92;
distSun = 1782;
cout<<"your weight";
cin>>weight;
cout<<"Speed(miles per hour)";
cin>>speed;
newWeight = weight * surfGrav;
distBetweenPlanets = abs(distSunEarth - distSun);
travelTime = distBetweenPlanets * 1000000 / speed;
} else if(selection == 'h'){
planetName = "Neptune";
surfGrav = 1.44;
distSun = 2793;
cout<<"your weight";
cin>>weight;
cout<<"Speed(miles per hour)";
cin>>speed;
newWeight = weight * surfGrav;
distBetweenPlanets = abs(distSunEarth - distSun);
travelTime = distBetweenPlanets * 1000000 / speed;
}
cout<<"INTERPLANETARY TRAVEL: "<<"Earth to "<<planetName<<endl;
cout<<"-------------------------------------------------"<<endl;
cout<<"Your weight on "<<planetName<<": "<<newWeight<<endl;
cout<<"Your travel time to "<<planetName<<":"<<endl;
cout<<"\tIn Hours: "<<travelTime<<endl;
cout<<"\tIn Days: "<<travelTime/24<<endl;
cout<<"\tIn Years: "<<travelTime/(365*24)<<endl;
}
}
Before you start doing this code Read carefully there is a format that you have to...
Astronomy helper Create an application that displays the following menu: select a planet 1. Mercury 2. Venus 3. Earth 4. Mars 5. exit the program Enter your selection. When the user selects a planet from the menu, the program should display data about the planet's average distance from the sun, the planet's surface temperature. Use the following data in your program: Mercury Average distance from the sun ---------- 57.9 million kilometers Mass---------------3.31 x 10^23kg surface temperature------------ -173 to 430 degrees...
VISUAL STUDIO - WINDOWS FORM APP (C#) - PLEASE MAKE SURE TO SHOW ALL CODE & ANSWER/FOLLOW ALL THE QUESTIONS IN THE ASSIGNMENT! Planet Info Help When planning this project, review the concept of accessing object properties on another form. Form2.IblMessage.Text = "1122.25" or you can put a string or object instead of numbers You can then create one form for the Planets information and set all the properties before you display the Planet Form For the pictures of the...
USE PYTHON 3, RUN THE CODE BEFORE POSTING THE ANSWER, AND READ THE ASSIGNMENT REQUIREMENTS NOTE CAREFULLY: Assignment Requirements NOTE: This program requires the use of if, elif, else, and casting between strings and numbers. The program should use the various code syntax covered in module 3. The program must result in print output using numeric input similar to that shown in the sample output below. Program: Cheese Order set values for maximum and minimum order variables set value for...
I want to have a code that can pick whichever two planets in the solar system and find the distance of them no matter where in their orbit they are, but I keep getting errors. Can someone please help me fix it? f rom scipy import exp, pi, absolute, linspace import matplotlib. Ryplot as plt planet-I input ('Which planet do you want to pick for planet 1?") planet_2 input ('which planet do you want to pick for planet 27') distance...
Follow instructions to create a visual C++ project, add the CH code, compile, fun and fix errors, Write your Name, course, and date as comments on first line. Write Program's Name epp (Give it your last name with the assignment number as a name... Program0 LAST NAME). Explain what the program is to do along with any directions or instructions needed for program users (ie the purpose of each library included next to #include directive, names and uses of identifiers...etc)....
Code In Python Well Document Code Every Line Please * You cannot use any external Python libraries. You can, of course, import the libraries that are included in the standard Python installation though. * Your software must use selection (if, if/ else, etc.) and repetitive (for, while, etc) control structures and have programmer defined functions. * Make sure you understand the code you submit since you will be expected to answer questions about it. The way the program should work...
Code In Python Well Document Code Every Line Please 5 Stars * You cannot use any external Python libraries. You can, of course, import the libraries that are included in the standard Python installation though. * Your software must use selection (if, if/ else, etc.) and repetitive (for, while, etc) control structures and have programmer defined functions. * Make sure you understand the code you submit since you will be expected to answer questions about it. The way the program...
Code In Python Well Document Code Every Line Please * You cannot use any external Python libraries. You can, of course, import the libraries that are included in the standard Python installation though. * Your software must use selection (if, if/ else, etc.) and repetitive (for, while, etc) control structures and have programmer defined functions. * Make sure you understand the code you submit since you will be expected to answer questions about it. The way the program should work...
PYTHON CODE DOCUMENT EVERY LINE * You cannot use any external Python libraries. You can, of course, import the libraries that are included in the standard Python installation though. * Your software must use selection (if, if/ else, etc.) and repetitive (for, while, etc) control structures and have programmer defined functions. * Make sure you understand the code you submit since you will be expected to answer questions about it. The way the program should work is the same as...
Programming in C with comments/steps 1. Overview The purpose of this assignment is to give you some experience with writing functions that take in arguments and return values, as well as writing a program that consists of multiple files. This assignment also requires the use of a switch statement, in addition to more practice with printf& scanf declaring variables, using loops, and using logical expressions. For this assignment, you will prompt the user in the main function to enter their...