Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Name: Planetary Travel and Reference Program
- Copyright: GUAGECAGE Inc.
- Author: Guagecage
- Date: 7/1/11 20:20
- Description: This is a program developed to approximate the length of time that it would
- take for the user to travel to another planet FROM the planet Earth. It also
- Gives the user an approximate weight in pounds relative to the weight of the
- user on planet earth to the gravitational pull of the destination planet
- of which they plan to travel.
- There are also advertisements from GUAGECAGE TECH Inc. here and there in the program
- depending on what the user may need to assist them while visiting their
- destination planet.
- */
- #include<iostream>
- #include<iomanip>
- using namespace std;
- int main()
- {
- char choice; // enables the use of the switch
- double weight, // this is used as the variable for the users weight
- WONP, // acronym and variable for Weight On New Planet
- speed, // this is used as the variable for the user desired rate of speed at which the user wants to travel
- travelTime; // this is the variable used for the distance from earth to the destination planet / the speed user wants to travel
- char name[16]; //enables the variable name to have 15 available "characters" entered as name
- /* This welcomes the user and notes that the program is designed to be used
- as earth as the departure planet*/
- cout << "\tHello and welcome to the Planetary Travel Reference Program.\n\n";
- cout << "\tThis program will inform the user of their approximate weight in\n";
- cout << "\tpounds on the planet in which they choose to visit, and it will\n";
- cout << "\talso estimate the user's travel time given the speed at which the\n";
- cout << "\tuser chooses to travel.\n\n";
- cout << "\t**NOTE** This program assumes the user will depart from EARTH.\n\n";
- cout << "\tLet's get started!\n\n\n";
- /* This is the first step of the calculations which asks for the users
- first name and uses the variable "name" */
- cout << ":::STEP 1:::\n\n";
- cout << "First, may I ask your first name ";
- cin >> name;
- cout <<"\n\n\n";
- /* This is the second step of the program which asks the user by the name that they entered to select
- the planet that they wish to travel to*/
- cout << ":::STEP 2:::\n\n";
- cout <<name<<", please take the time to browse over the list of planets below\n";
- cout << "and choose the appropriate letter that corresponds to the planet\n";
- cout << "that you intend to travel to.\n\n";
- cout << " \tA) Mercury \n";
- cout << " \tB) Venus \n";
- cout << " \tC) Earth \n";
- cout << " \tD) Mars \n";
- cout << " \tE) Jupiter \n";
- cout << " \tF) Saturn \n";
- cout << " \tG) Uranus \n";
- cout << " \tH) Neptune \n\n";
- cout << "Please enter your choice: ";
- cin >> choice;
- cout<<"\n\n";
- /* This below sets the decimal point for all that follows beneath to
- 2 decimal places*/
- cout << fixed << showpoint << setprecision(2);
- /* This tells the program that the user at this point should have made a selection and
- it is the user input designated as "choice". After which the program use the appropriate
- CASE to run the rest of this program and display results*/
- switch (choice)
- {
- /* This is the last steps of the program which are used if the user has chosen
- to travel to MERCURY. Using case 'a' and case 'A' allow for the user to enter
- lower case or upper case letters without disrupting program integrity*/
- case 'a':
- case 'A': cout << "Thank you " << name << "\n\n\n";
- cout << ":::STEP 3:::\n\n";// User is asked to enter their weight.
- cout << "May I have your current weight in pounds: ";
- cin >> weight;
- cout << "\n\n";
- cout << ":::STEP 4:::\n\n";// User is asked to enter the rate in MPH at which they desire to travel.
- cout << "At what speed would you like to travel?\n";
- cout << "Please enter a speed based on miles per hour: ";
- cin >> speed ;
- cout << "\n\n";
- WONP = (.27*weight);//Calculation for weight on new planet= .27 x users weight as Mercury's gravity is .27 of earths
- travelTime = (6.0E7/speed);//Calculation for travel time = 60,000,000miles/users desired travel speed
- cout << ":::RESULTS:::\n\n";// This displays the results of the calculations addressing the user by their name
- cout << "\t-"<<name << ", at the speed of "<<speed<<"mph, it will take\n";
- cout << "\t you "<<travelTime<<" hours to arrive at the planet Mercury.\n\n";
- cout << "\t-Be prepared for an uplifting experience as your weight on\n";
- cout << "\t Mercury will be "<<WONP<<"lbs.\n\n";
- // This thanks the user for using The program designed by GUAGECAGE Inc. while at times promoting other products
- cout << "\t**Thank you "<<name<<" for using the Planetary Travel Reference Program.\n";
- cout << "\t**We at GUAGECAGE Inc. hope that you will consider us when in need of\n";
- cout << "\t**other calculations like our soon to be released Calorie Calculator\n";
- cout << "\t**For Planetary Travelers program, for those travelers concerned with\n";
- cout << "\t**weight gain while visiting lower gravity planets.\n\n\n";
- break;
- /* This is the last steps of the program which are used if the user has chosen
- to travel to Venus. Using case 'b' and case 'B' allow for the user to enter
- lower case or upper case letters without disrupting program integrity*/
- case 'b':
- case 'B': cout << "Thank you " << name <<"\n\n";
- cout << ":::STEP 3:::\n\n";// User is asked to enter their weight.
- cout << "May I have your current weight in pounds: ";
- cin >> weight;
- cout << "\n\n";
- cout << ":::STEP 4:::\n\n";// User is asked to enter the rate in MPH at which they desire to travel. This is relative to each case
- cout << "At what speed would you like to travel?\n";
- cout << "Please enter a speed based on miles per hour: ";
- cin >> speed ;
- cout << "\n\n";
- WONP = (.086*weight);//Calculation for weight on new planet= .086 x users weight as Venus's gravity is .086 of earths
- travelTime = (2.6E7/speed);//Calculation for travel time = 26,000,000miles/users desired travel speed
- // This displays the results of the calculations addressing the user by their name
- cout << ":::RESULTS:::\n\n";
- cout << "\t-"<< name << ", at the speed of "<<speed<<"mph, it will take\n";
- cout << "\t you "<<travelTime<<" hours to arrive at the planet Venus.\n\n";
- cout << "\t-You will feel even lighter than if you travleded to Mercury\n";
- cout << "\t at a weight on Venus of "<<WONP<<"lbs.\n\n";
- // This thanks the user for using The program designed by GUAGECAGE Inc. while at times
- // promoting other products
- cout << "\t**Thank you "<<name<<" for using the Planetary Travel Reference Program.\n\n";
- cout << "\t**Also be sure to pick up a packet of Ultra Galactic Sun Block and Skin\n";
- cout << "\t**Conditioner from GUAGECAGE Inc., The makers of That Gun is Huge and\n";
- cout << "\t** Ultra Finger Nail Clippers.\n\n\n";
- break;
- /* This is the last steps of the program which are used if the user has chosen
- to travel to EARTH. Using case 'c' and case 'C' allow for the user to enter
- lower case or upper case letters without disrupting program integrity*/
- case 'c':
- case 'C': cout << "\tThank you " << name <<"\n\n";
- // This displays the results of the calculations addressing the user by their name
- cout << ":::RESULTS:::\n\n";
- cout << "\tAs the instructions asked for this program to calculate the user's\n";
- cout << "\tweight on the planet and travel time FROM Earth, your current \n";
- cout << "\tweight is accurate and you are already on the planet which you would\n";
- cout << "\tlike to travel to so there is no Travel Time.\n\n";
- // This thanks the user for using The program designed by GUAGECAGE Inc. while at times
- // promoting other products
- cout << "\t**Thank you "<<name<<" for using the Planetary Travel Reference Program.\n\n";
- cout << "\t**Be sure to pick up your digital copy of Common Sense and How it\n";
- cout << "\t**Escapes Us. Another great publication by GUAGECAGE Inc.,Teaching\n";
- cout << "\t**the illiterate to read , the galaxy over.\n\n\n";
- break;
- /* This is the last steps of the program which are used if the user has chosen
- to travel to MARS. Using case 'd' and case 'D' allow for the user to enter
- lower case or upper case letters without disrupting program integrity*/
- case 'd':
- case 'D': cout << "Thank you " << name <<"\n\n";
- cout << ":::STEP 3:::\n\n";// User is asked to enter their weight.
- cout << "May I have your current weight in pounds: ";
- cin >> weight;
- cout << "\n\n";
- cout << ":::STEP 4:::\n\n";// User is asked to enter the rate in MPH at which they desire to travel. This is relative to each case
- cout << "At what speed would you like to travel?\n";
- cout << "Please enter a speed based on miles per hour: ";
- cin >> speed ;
- cout << "\n\n";
- WONP = (.37*weight);//Calculation for weight on new planet= .37 x users weight as Mars' gravity is .37 of earths
- travelTime = (4.8E7/speed);//Calculation for travel time = 48,000,000miles/users desired travel speed
- // This displays the results of the calculations addressing the user by their name
- cout << ":::RESULTS:::\n\n";
- cout << "\t-"<< name << ", at the speed of "<<speed<<"mph, it will take\n";
- cout << "\t you "<<travelTime<<" hours to arrive at the planet MARS.\n\n";
- cout << "\t-You wont feel as light as you would on Mercury but you will\n";
- cout << "\t feel lighter at a weight on mars of "<<WONP<<"lbs.\n\n";
- // This thanks the user for using The program designed by GUAGECAGE Inc. while at times
- // promoting other products
- cout << "\t**Thank you "<<name<<" for using the Planetary Travel Reference Program.\n\n";
- cout << "\t**Show those martians a thing or two about abductions with the all new \n";
- cout << "\t**Super Digger Anal Probe, from GUAGECAGE Inc.\n";
- cout << "\t**Now who's laughing martians\n\n\n";
- break;
- /* This is the last steps of the program which are used if the user has chosen
- to travel to JUPITER. Using case 'e' and case 'E' allow for the user to enter
- lower case or upper case letters without disrupting program integrity*/
- case 'e':
- case 'E': cout << "Thank you " << name <<"\n\n";
- cout << ":::STEP 3:::\n\n";// User is asked to enter their weight.
- cout << "May I have your current weight in pounds: ";
- cin >> weight;
- cout << "\n\n";
- cout << ":::STEP 4:::\n\n";// User is asked to enter the rate in MPH at which they desire to travel. This is relative to each case
- cout << "At what speed would you like to travel?\n";
- cout << "Please enter a speed based on miles per hour: ";
- cin >> speed ;
- cout << "\n\n";
- WONP = (2.64*weight);//Calculation for weight on new planet= 2.64 x users weight as Jupiter's gravity is 2.64 x greater than that of earths
- travelTime = (3.9E8/speed);//Calculation for travel time = 390,000,000miles/users desired travel speed
- // This displays the results of the calculations addressing the user by their name
- cout << ":::RESULTS:::\n\n";
- cout << "\t-"<< name << ", at the speed of "<<speed<<"mph, it will take\n";
- cout << "\t you "<<travelTime<<" hours to arrive at the planet Jupiter.\n\n";
- cout << "\t-Hopefully you have been working out or you own an Exoskeleton\n";
- cout << "\t from the Warrior line of personal exoskeletons by GUAGECAGE Inc. as\n";
- cout << "\t as your weight on Jupiter will be "<<WONP<<"lbs.\n\n";
- // This thanks the user for using The program designed by GUAGECAGE Inc. while at times
- // promoting other products
- cout << "\t**Thank you "<<name<<" for using the Planetary Travel Reference Program.\n";
- cout << "\t**Be sure to checkout our full line of Exoskeletons including our\n";
- cout << "\t**newest military model, The Annihilator. Now outfitted with the \n";
- cout << "\t**Super Grip boot and Kinetic Shielding Array to get a grip and weather\n";
- cout << "\t**out those nasty storms.\n\n\n";
- break;
- /* This is the last steps of the program which are used if the user has chosen
- to travel to SATURN. Using case 'f' and case 'F' allow for the user to enter
- lower case or upper case letters without disrupting program integrity*/
- case 'f':
- case 'F': cout << "Thank you " << name <<"\n\n";
- cout << ":::STEP 3:::\n\n";// User is asked to enter their weight.
- cout << "May I have your current weight in pounds: ";
- cin >> weight;
- cout << "\n\n";
- cout << ":::STEP 4:::\n\n";// User is asked to enter the rate in MPH at which they desire to travel. This is relative to each case
- cout << "At what speed would you like to travel?\n";
- cout << "Please enter a speed based on miles per hour: ";
- cin >> speed ;
- cout << "\n\n";
- WONP = (1.17*weight);//Calculation for weight on new planet= 1.17 x users weight as Saturn's gravity is 1.17 x greater than that of earths
- travelTime = (7.93E8/speed);//Calculation for travel time = 793,000,000miles/users desired travel speed
- // This displays the results of the calculations addressing the user by their name
- cout << ":::RESULTS:::\n\n";
- cout << "\t-"<< name << ", at the speed of "<<speed<<"mph, it will take\n";
- cout << "\t you "<<travelTime<<" hours to arrive at the planet Saturn.\n\n";
- cout << "\t-Although not as heavy as you will feel on Jupiter, you will\n";
- cout << "\t feel heavier on Saturn at a weight of "<<WONP<<"lbs.\n";
- cout << "\t This is when all those days of squats are going to pay off.\n\n";
- // This thanks the user for using The program designed by GUAGECAGE Inc. while at times
- // promoting other products
- cout << "\t**Thank you "<<name<<" for using the Planetary Travel Reference Program.\n\n";
- cout << "\t**Be sure to stop by GUAGECAGE Inc.'s State of the art Waste reclamation\n";
- cout << "\t**center located on Saturn. This month only BOGO entrance tickets.\n\n\n";
- break;
- /* This is the last steps of the program which are used if the user has chosen
- to travel to Uranus. Using case 'g' and case 'G' allow for the user to enter
- lower case or upper case letters without disrupting program integrity */
- case 'g':
- case 'G': cout << "Thank you " << name <<"\n\n";
- cout << ":::STEP 3:::\n\n";// User is asked to enter their weight.
- cout << "May I have your current weight in pounds: ";
- cin >> weight;
- cout << "\n\n";
- cout << ":::STEP 4:::\n\n";// User is asked to enter the rate in MPH at which they desire to travel. This is relative to each case
- cout << "At what speed would you like to travel?\n";
- cout << "Please enter a speed based on miles per hour: ";
- cin >> speed ;
- cout << "\n\n";
- WONP = (.092*weight);//Calculation for weight on new planet= .092 x users weight as Uranus's gravity is .27 of earths
- travelTime = (1.689E9/speed);//Calculation for travel time = 1,689,000,000miles/users desired travel speed
- // This displays the results of the calculations addressing the user by their name
- cout << ":::RESULTS:::\n\n";
- cout << "\t-"<< name << ", at the speed of "<<speed<<"mph, it will take\n";
- cout << "\t you "<<travelTime<<" hours to arrive at the planet Uranus.\n\n";
- cout << "\t-While on the planet of Uranus, you will enjoy the slight decrease in \n";
- cout << "\t gravity. At a weight of "<<WONP<<"lbs you will have a little\n";
- cout << "\t extra pep in your step.\n\n";
- // This thanks the user for using The program designed by GUAGECAGE Inc. while at times
- // promoting other products
- cout << "\t**Thank you "<<name<<" for using the Planetary Travel Reference Program.\n\n";
- cout << "\t**While visiting Uranus, be sure to pack a double pallet load of GUAGECAGE \n";
- cout << "\t**Inc.'s Ultra Durable Toilet Paper. Made to withstand a meteor shower\n";
- cout << "\t**and absorbent enough to clean up after those pesky nuclear fallouts.\n\n\n";
- break;
- /* This is the last steps of the program which are used if the user has chosen
- to travel to NEPTUNE. Using case 'h' and case 'H' allow for the user to enter
- lower case or upper case letters without disrupting program integrity*/
- case 'h':
- case 'H': cout << "Thank you " << name <<"\n\n";
- cout << ":::STEP 3:::\n\n";// User is asked to enter their weight.
- cout << "May I have your current weight in pounds: ";
- cin >> weight;
- cout << "\n\n";
- cout << ":::STEP 4:::\n\n";// User is asked to enter the rate in MPH at which they desire to travel. This is relative to each case
- cout << "At what speed would you like to travel?\n";
- cout << "Please enter a speed based on miles per hour: ";
- cin >> speed ;
- cout << "\n\n";
- WONP = (1.44*weight);//Calculation for weight on new planet= 1.44 x users weight as Neptune's gravity is 1.44 x greater than that of earths
- travelTime = (2.7E9/speed);//Calculation for travel time = 2,700,000,000miles/users desired travel speed
- // This displays the results of the calculations addressing the user by their name
- cout << ":::RESULTS:::\n\n";
- cout << "\t-"<< name << ", at the speed of "<<speed<<"mph, it will take\n";
- cout << "\t you "<<travelTime<<" hours to arrive at the planet Neptune.\n\n";
- cout << "\t-Though not as strong of a gravitational pull as the one found\n";
- cout << "\t on Jupiter, Neptune's Gravity is stronger than earth's increasing\n";
- cout << "\t your weight to "<<WONP<<"lbs.\n\n";
- // This thanks the user for using The program designed by GUAGECAGE Inc. while at times
- // promoting other products
- cout << "\t**Thank you "<<name<<" for using the Planetary Travel Reference Program.\n\n\n";
- break;
- /* If the user enters a letter not shown as a choice this will be displayed on the screen. Turns
- out that GUAGECAGE has a solution for nearly everything*/
- default: cout << "\tThe only valid choices are a,b,c,d,e,f,g,or h. Please restart the\n";
- cout << "\tprogram and make one of the valid choices. Also be sure to checkout\n";
- cout << "\tLearning to Read, a program brought to you by GUAGECAGE Inc. Teaching\n";
- cout << "\tthe illiterate to read, the galaxy over.\n";
- }
- system("PAUSE");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement