Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 25.22 KB | None | 0 0
  1. /*
  2.  Name: Planetary Travel and Reference Program
  3.  Copyright: GUAGECAGE Inc.
  4.  Author: Guagecage
  5.  Date: 7/1/11 20:20
  6.  Description: This is a program developed to approximate the length of time that it would
  7.               take for the user to travel to another planet FROM the planet Earth. It also
  8.               Gives the user an approximate weight in pounds relative to the weight of the
  9.               user on planet earth to the gravitational pull of the destination planet
  10.               of which they plan to travel.
  11.               There are also advertisements from GUAGECAGE TECH Inc. here and there in the program
  12.               depending on what the user may need to assist them while visiting their
  13.               destination planet.
  14. */
  15.  
  16. #include<iostream>
  17. #include<iomanip>
  18. using namespace std;
  19.  
  20. int main()
  21. {
  22.    char choice;       // enables the use of the switch
  23.    double weight,     // this is used as the variable for the users weight
  24.           WONP,       // acronym and variable for Weight On New Planet
  25.           speed,      // this is used as the variable for the user desired rate of speed at which the user wants to travel
  26.           travelTime; // this is the variable used for the distance from earth to the destination planet / the speed user      wants to travel
  27.        
  28.    char name[16];     //enables the variable name to have 15 available "characters" entered as name
  29.    
  30.         /* This welcomes the user and notes that the program is designed to be used
  31.            as earth as the departure planet*/
  32.        cout << "\tHello and welcome to the Planetary Travel Reference Program.\n\n";
  33.        cout << "\tThis program will inform the user of their approximate weight in\n";
  34.        cout << "\tpounds on the planet in which they choose to visit, and it will\n";
  35.        cout << "\talso estimate the user's travel time given the speed at which the\n";
  36.        cout << "\tuser chooses to travel.\n\n";
  37.        cout << "\t**NOTE** This program assumes the user will depart from EARTH.\n\n";
  38.        cout << "\tLet's get started!\n\n\n";
  39.        
  40.             /* This is the first step of the calculations which asks for the users
  41.                first name and uses the variable "name" */
  42.            cout << ":::STEP 1:::\n\n";
  43.            cout << "First, may I ask your first name ";
  44.            cin >> name;
  45.            cout <<"\n\n\n";
  46.            
  47.                 /* This is the second step of the program which asks the user by the name that they entered to select
  48.                    the planet that they wish to travel to*/
  49.                cout << ":::STEP 2:::\n\n";
  50.                cout <<name<<", please take the time to browse over the list of planets below\n";
  51.                cout << "and choose the appropriate letter that corresponds to the planet\n";
  52.                cout << "that you intend to travel to.\n\n";
  53.                cout << " \tA) Mercury \n";
  54.                cout << " \tB) Venus \n";
  55.                cout << " \tC) Earth \n";
  56.                cout << " \tD) Mars \n";
  57.                cout << " \tE) Jupiter \n";
  58.                cout << " \tF) Saturn \n";
  59.                cout << " \tG) Uranus \n";
  60.                cout << " \tH) Neptune \n\n";
  61.                cout << "Please enter your choice: ";
  62.                cin >> choice;
  63.                cout<<"\n\n";
  64.                
  65.                /* This below sets the decimal point for all that follows beneath to
  66.                   2 decimal places*/
  67.                cout << fixed << showpoint << setprecision(2);
  68.                
  69.                /* This tells the program that the user at this point should have made a selection and
  70.                   it is the user input designated as "choice". After which the program use the appropriate
  71.                   CASE to run the rest of this program and display results*/
  72.                switch (choice)
  73.                {    
  74.                   /* This is the last steps of the program which are used if the user has chosen
  75.                      to travel to MERCURY. Using case 'a' and case 'A' allow for the user to enter
  76.                      lower case or upper case letters without disrupting program integrity*/
  77.                   case 'a':                                          
  78.                   case 'A': cout << "Thank you " << name << "\n\n\n";
  79.                  
  80.                             cout << ":::STEP 3:::\n\n";// User is asked to enter their weight.
  81.                             cout << "May I have your current weight in pounds: ";
  82.                             cin >> weight;
  83.                             cout << "\n\n";
  84.                                        
  85.                             cout << ":::STEP 4:::\n\n";// User is asked to enter the rate in MPH at which they desire to travel.
  86.                             cout << "At what speed would you like to travel?\n";
  87.                             cout << "Please enter a speed based on miles per hour: ";
  88.                             cin >> speed ;
  89.                             cout << "\n\n";
  90.                            
  91.                             WONP = (.27*weight);//Calculation for weight on new planet= .27 x users weight as Mercury's gravity is .27 of earths
  92.                             travelTime = (6.0E7/speed);//Calculation for travel time = 60,000,000miles/users desired travel speed
  93.                            
  94.                             cout << ":::RESULTS:::\n\n";// This displays the results of the calculations addressing the user by their name
  95.                             cout << "\t-"<<name << ", at the speed of "<<speed<<"mph, it will take\n";
  96.                             cout << "\t you "<<travelTime<<" hours to arrive at the planet Mercury.\n\n";
  97.                             cout << "\t-Be prepared for an uplifting experience as your weight on\n";
  98.                             cout << "\t Mercury will be "<<WONP<<"lbs.\n\n";
  99.                            
  100.                             // This thanks the user for using The program designed by GUAGECAGE  Inc. while at times promoting other products
  101.                             cout << "\t**Thank you "<<name<<" for using the Planetary Travel Reference Program.\n";
  102.                             cout << "\t**We at GUAGECAGE  Inc. hope that you will consider us when in need of\n";
  103.                             cout << "\t**other calculations like our soon to be released Calorie Calculator\n";
  104.                             cout << "\t**For Planetary Travelers program, for those travelers concerned with\n";
  105.                             cout << "\t**weight gain while visiting lower gravity planets.\n\n\n";
  106.                             break;
  107.                
  108.                   /* This is the last steps of the program which are used if the user has chosen
  109.                      to travel to Venus. Using case 'b' and case 'B' allow for the user to enter
  110.                      lower case or upper case letters without disrupting program integrity*/
  111.                   case 'b':
  112.                   case 'B': cout << "Thank you " << name <<"\n\n";
  113.                  
  114.                             cout << ":::STEP 3:::\n\n";// User is asked to enter their weight.
  115.                             cout << "May I have your current weight in pounds: ";
  116.                             cin >> weight;
  117.                             cout << "\n\n";
  118.                            
  119.                             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
  120.                             cout << "At what speed would you like to travel?\n";
  121.                             cout << "Please enter a speed based on miles per hour: ";
  122.                             cin >> speed ;
  123.                             cout << "\n\n";
  124.                            
  125.                             WONP = (.086*weight);//Calculation for weight on new planet= .086 x users weight as Venus's gravity is .086 of earths
  126.                             travelTime = (2.6E7/speed);//Calculation for travel time = 26,000,000miles/users desired travel speed
  127.                            
  128.                              // This displays the results of the calculations addressing the user by their name
  129.                             cout << ":::RESULTS:::\n\n";
  130.                             cout << "\t-"<< name << ", at the speed of "<<speed<<"mph, it will take\n";
  131.                             cout << "\t you "<<travelTime<<" hours to arrive at the planet Venus.\n\n";
  132.                             cout << "\t-You will feel even lighter than if you travleded to Mercury\n";
  133.                             cout << "\t at a weight on Venus of "<<WONP<<"lbs.\n\n";
  134.                            
  135.                             // This thanks the user for using The program designed by GUAGECAGE Inc. while at times
  136.                             // promoting other products
  137.                             cout << "\t**Thank you "<<name<<" for using the Planetary Travel Reference Program.\n\n";
  138.                             cout << "\t**Also be sure to pick up a packet of Ultra Galactic Sun Block and Skin\n";
  139.                             cout << "\t**Conditioner from GUAGECAGE Inc., The makers of That Gun is Huge and\n";
  140.                             cout << "\t** Ultra Finger Nail Clippers.\n\n\n";
  141.                             break;
  142.                            
  143.                   /* This is the last steps of the program which are used if the user has chosen
  144.                      to travel to EARTH. Using case 'c' and case 'C' allow for the user to enter
  145.                      lower case or upper case letters without disrupting program integrity*/
  146.                   case 'c':
  147.                   case 'C': cout << "\tThank you " << name <<"\n\n";
  148.                  
  149.                             // This displays the results of the calculations addressing the user by their name
  150.                             cout << ":::RESULTS:::\n\n";
  151.                             cout << "\tAs the instructions asked for this program to calculate the user's\n";
  152.                             cout << "\tweight on the planet and travel time FROM Earth, your current \n";
  153.                             cout << "\tweight is accurate and you are already on the planet which you would\n";
  154.                             cout << "\tlike to travel to so there is no Travel Time.\n\n";
  155.                            
  156.                             // This thanks the user for using The program designed by GUAGECAGE  Inc. while at times
  157.                             // promoting other products
  158.                            
  159.                             cout << "\t**Thank you "<<name<<" for using the Planetary Travel Reference Program.\n\n";
  160.                             cout << "\t**Be sure to pick up your digital copy of Common Sense and How it\n";
  161.                             cout << "\t**Escapes Us. Another great publication by GUAGECAGE  Inc.,Teaching\n";
  162.                             cout << "\t**the illiterate to read , the galaxy over.\n\n\n";
  163.                             break;
  164.                            
  165.                   /* This is the last steps of the program which are used if the user has chosen
  166.                      to travel to MARS. Using case 'd' and case 'D' allow for the user to enter
  167.                      lower case or upper case letters without disrupting program integrity*/
  168.                   case 'd':
  169.                   case 'D': cout << "Thank you " << name <<"\n\n";
  170.                  
  171.                             cout << ":::STEP 3:::\n\n";// User is asked to enter their weight.
  172.                             cout << "May I have your current weight in pounds: ";
  173.                             cin >> weight;
  174.                             cout << "\n\n";
  175.                            
  176.                             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
  177.                             cout << "At what speed would you like to travel?\n";
  178.                             cout << "Please enter a speed based on miles per hour: ";
  179.                             cin >> speed ;
  180.                             cout << "\n\n";
  181.                            
  182.                             WONP = (.37*weight);//Calculation for weight on new planet= .37 x users weight as Mars' gravity is .37 of earths
  183.                             travelTime = (4.8E7/speed);//Calculation for travel time = 48,000,000miles/users desired travel speed
  184.                            
  185.                              // This displays the results of the calculations addressing the user by their name
  186.                             cout << ":::RESULTS:::\n\n";
  187.                             cout << "\t-"<< name << ", at the speed of "<<speed<<"mph, it will take\n";
  188.                             cout << "\t you "<<travelTime<<" hours to arrive at the planet MARS.\n\n";
  189.                             cout << "\t-You wont feel as light as you would on Mercury but you will\n";
  190.                             cout << "\t feel lighter at a weight on mars of "<<WONP<<"lbs.\n\n";
  191.                            
  192.                             // This thanks the user for using The program designed by GUAGECAGE Inc. while at times
  193.                             // promoting other products
  194.                             cout << "\t**Thank you "<<name<<" for using the Planetary Travel Reference Program.\n\n";
  195.                             cout << "\t**Show those martians a thing or two about abductions with the all new \n";
  196.                             cout << "\t**Super Digger Anal Probe, from GUAGECAGE  Inc.\n";
  197.                             cout << "\t**Now who's laughing martians\n\n\n";  
  198.                             break;
  199.                            
  200.                   /* This is the last steps of the program which are used if the user has chosen
  201.                      to travel to JUPITER. Using case 'e' and case 'E' allow for the user to enter
  202.                      lower case or upper case letters without disrupting program integrity*/
  203.                   case 'e':
  204.                   case 'E': cout << "Thank you " << name <<"\n\n";
  205.                  
  206.                             cout << ":::STEP 3:::\n\n";// User is asked to enter their weight.
  207.                             cout << "May I have your current weight in pounds: ";
  208.                             cin >> weight;
  209.                             cout << "\n\n";
  210.                            
  211.                             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
  212.                             cout << "At what speed would you like to travel?\n";
  213.                             cout << "Please enter a speed based on miles per hour: ";
  214.                             cin >> speed ;
  215.                             cout << "\n\n";
  216.                            
  217.                             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
  218.                             travelTime = (3.9E8/speed);//Calculation for travel time = 390,000,000miles/users desired travel speed
  219.                            
  220.                              // This displays the results of the calculations addressing the user by their name
  221.                             cout << ":::RESULTS:::\n\n";
  222.                             cout << "\t-"<< name << ", at the speed of "<<speed<<"mph, it will take\n";
  223.                             cout << "\t you "<<travelTime<<" hours to arrive at the planet Jupiter.\n\n";
  224.                             cout << "\t-Hopefully you have been working out or you own an Exoskeleton\n";
  225.                             cout << "\t from the Warrior line of personal exoskeletons by GUAGECAGE  Inc. as\n";
  226.                             cout << "\t as your weight on Jupiter will be "<<WONP<<"lbs.\n\n";
  227.                            
  228.                             // This thanks the user for using The program designed by GUAGECAGE  Inc. while at times
  229.                             // promoting other products
  230.                             cout << "\t**Thank you "<<name<<" for using the Planetary Travel Reference Program.\n";
  231.                             cout << "\t**Be sure to checkout our full line of Exoskeletons including our\n";
  232.                             cout << "\t**newest military model, The Annihilator. Now outfitted with the \n";
  233.                             cout << "\t**Super Grip boot and Kinetic Shielding Array to get a grip and weather\n";
  234.                             cout << "\t**out those nasty storms.\n\n\n";              
  235.                             break;
  236.                            
  237.                   /* This is the last steps of the program which are used if the user has chosen
  238.                      to travel to SATURN. Using case 'f' and case 'F' allow for the user to enter
  239.                      lower case or upper case letters without disrupting program integrity*/
  240.                   case 'f':
  241.                   case 'F': cout << "Thank you " << name <<"\n\n";
  242.                  
  243.                             cout << ":::STEP 3:::\n\n";// User is asked to enter their weight.
  244.                             cout << "May I have your current weight in pounds: ";
  245.                             cin >> weight;
  246.                             cout << "\n\n";
  247.                            
  248.                             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
  249.                             cout << "At what speed would you like to travel?\n";
  250.                             cout << "Please enter a speed based on miles per hour: ";
  251.                             cin >> speed ;
  252.                             cout << "\n\n";
  253.                            
  254.                             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
  255.                             travelTime = (7.93E8/speed);//Calculation for travel time = 793,000,000miles/users desired travel speed
  256.                            
  257.                              // This displays the results of the calculations addressing the user by their name
  258.                             cout << ":::RESULTS:::\n\n";
  259.                             cout << "\t-"<< name << ", at the speed of "<<speed<<"mph, it will take\n";
  260.                             cout << "\t you "<<travelTime<<" hours to arrive at the planet Saturn.\n\n";
  261.                             cout << "\t-Although not as heavy as you will feel on Jupiter, you will\n";
  262.                             cout << "\t feel heavier on Saturn at a weight of "<<WONP<<"lbs.\n";
  263.                             cout << "\t This is when all those days of squats are going to pay off.\n\n";
  264.                            
  265.                             // This thanks the user for using The program designed by GUAGECAGE  Inc. while at times
  266.                             // promoting other products
  267.                             cout << "\t**Thank you "<<name<<" for using the Planetary Travel Reference Program.\n\n";
  268.                             cout << "\t**Be sure to stop by GUAGECAGE  Inc.'s State of the art Waste reclamation\n";
  269.                             cout << "\t**center located on Saturn. This month only BOGO entrance tickets.\n\n\n";
  270.                             break;
  271.                            
  272.                   /* This is the last steps of the program which are used if the user has chosen
  273.                      to travel to Uranus. Using case 'g' and case 'G' allow for the user to enter
  274.                      lower case or upper case letters without disrupting program integrity */
  275.                   case 'g':
  276.                   case 'G': cout << "Thank you " << name <<"\n\n";
  277.                  
  278.                             cout << ":::STEP 3:::\n\n";// User is asked to enter their weight.
  279.                             cout << "May I have your current weight in pounds: ";
  280.                             cin >> weight;
  281.                             cout << "\n\n";
  282.                            
  283.                             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
  284.                             cout << "At what speed would you like to travel?\n";
  285.                             cout << "Please enter a speed based on miles per hour: ";
  286.                             cin >> speed ;
  287.                             cout << "\n\n";
  288.                            
  289.                             WONP = (.092*weight);//Calculation for weight on new planet= .092 x users weight as Uranus's gravity is .27 of earths
  290.                             travelTime = (1.689E9/speed);//Calculation for travel time = 1,689,000,000miles/users desired travel speed
  291.                            
  292.                              // This displays the results of the calculations addressing the user by their name
  293.                             cout << ":::RESULTS:::\n\n";
  294.                             cout << "\t-"<< name << ", at the speed of "<<speed<<"mph, it will take\n";
  295.                             cout << "\t you "<<travelTime<<" hours to arrive at the planet Uranus.\n\n";
  296.                             cout << "\t-While on the planet of Uranus, you will enjoy the slight decrease in \n";
  297.                             cout << "\t gravity. At a weight of "<<WONP<<"lbs you will have a little\n";
  298.                             cout << "\t extra pep in your step.\n\n";
  299.                            
  300.                             // This thanks the user for using The program designed by GUAGECAGE  Inc. while at times
  301.                             // promoting other products
  302.                             cout << "\t**Thank you "<<name<<" for using the Planetary Travel Reference Program.\n\n";
  303.                             cout << "\t**While visiting Uranus, be sure to pack a double pallet load of GUAGECAGE \n";
  304.                             cout << "\t**Inc.'s Ultra Durable Toilet Paper. Made to withstand a meteor shower\n";
  305.                             cout << "\t**and absorbent enough to clean up after those pesky nuclear fallouts.\n\n\n";
  306.                             break;
  307.                            
  308.                   /* This is the last steps of the program which are used if the user has chosen
  309.                      to travel to NEPTUNE. Using case 'h' and case 'H' allow for the user to enter
  310.                      lower case or upper case letters without disrupting program integrity*/
  311.                   case 'h':
  312.                   case 'H': cout << "Thank you " << name <<"\n\n";
  313.                  
  314.                             cout << ":::STEP 3:::\n\n";// User is asked to enter their weight.
  315.                             cout << "May I have your current weight in pounds: ";
  316.                             cin >> weight;
  317.                             cout << "\n\n";
  318.                            
  319.                             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
  320.                             cout << "At what speed would you like to travel?\n";
  321.                             cout << "Please enter a speed based on miles per hour: ";
  322.                             cin >> speed ;
  323.                             cout << "\n\n";
  324.                            
  325.                             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
  326.                             travelTime = (2.7E9/speed);//Calculation for travel time = 2,700,000,000miles/users desired travel speed
  327.                            
  328.                              // This displays the results of the calculations addressing the user by their name
  329.                             cout << ":::RESULTS:::\n\n";
  330.                             cout << "\t-"<< name << ", at the speed of "<<speed<<"mph, it will take\n";
  331.                             cout << "\t you "<<travelTime<<" hours to arrive at the planet Neptune.\n\n";
  332.                             cout << "\t-Though not as strong of a gravitational pull as the one found\n";
  333.                             cout << "\t on Jupiter, Neptune's Gravity is stronger than earth's increasing\n";  
  334.                             cout << "\t your weight to "<<WONP<<"lbs.\n\n";
  335.                            
  336.                             // This thanks the user for using The program designed by GUAGECAGE  Inc. while at times
  337.                             // promoting other products
  338.                             cout << "\t**Thank you "<<name<<" for using the Planetary Travel Reference Program.\n\n\n";
  339.                             break;
  340.                            
  341.                   /* If the user enters a letter not shown as a choice this will be displayed on the screen. Turns
  342.                      out that GUAGECAGE  has a solution for nearly everything*/
  343.                   default:  cout << "\tThe only valid choices are a,b,c,d,e,f,g,or h. Please restart the\n";
  344.                             cout << "\tprogram and make one of the valid choices. Also be sure to checkout\n";
  345.                             cout << "\tLearning to Read, a program brought to you by GUAGECAGE   Inc. Teaching\n";
  346.                             cout << "\tthe illiterate to read, the galaxy over.\n";
  347.                  
  348.                             }
  349.                  
  350.                             system("PAUSE");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement