This program goes where no program has gone before, exploring new frontiers in C++.  The program performs calculations concerning weight on various planets as well as travel time between planets.  In main, use vectors to hold planet names, distance from the sun, and the specific gravity on each planet.  These are parallel vectors, so that the information at a position in each vector refers to information concerning the same planet.   Your program should first declare variables, include your vectors.   Display your course header with the program title and a brief introduction using a cout.  Load the data into the three vectors.  Start a do while loop as your Play loop.    Ask for the user’s name, Earth weight, the speed they want to travel and the planet they wish to visit.  You will need to provide a menu with the planet names and a way for the user to select the chosen destination.   Your interaction with the user should look similar to this:     Using the data you have obtained from the user, determine the user’s weight on the destination planet and the travel time in hours.    These equations might be useful: Weight on New Planet = Weight on Earth * Relative Surface Gravity of New Planet Travel Time (hours) = Travel Distance (miles) / Speed of Travel(mph)     Use the data in this table to load the arrays:   Planet Distance from Sun (millions of miles) Surface Gravity as a Percent of Earth’s Gravity Mercury 36 0.27 Venus 67 0.86 Earth 93 1.00 Mars 141 0.37 Jupiter 483 2.64 Saturn 886 1.17 Uranus 1782 0.92 Neptune 2793 1.44   Display the traveler’s name, weight on Earth, the destination planet and weight on that planet.   Also report travel time results:  Break down the travel time into years, days and hours.  You may use 24 hours in a day and 365 days in a year (ignore leap years).  Display the number of years, days and hours required for the trip.   Your program should have only one set of result variables.  The code for the calculations and resultant output should be written in only one place in your program.  Do not duplicate code and calculation for each planet.  Make your program as efficient as possible without losing clarity.   Ask the user if they would like to calculate another space trip.  Remember to tell the user the choices for an answer.  If they say yes, loop up to the top of the Play Loop.  When the user is done, present a good-bye message.   Set the precision, etc, so you are reporting floating point numbers with 2 decimal places.   Use functions to get information from the user, fill vectors, complete calculations and display menus and final report.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

 

 

This program goes where no program has gone before, exploring new frontiers in C++.  The program performs calculations concerning weight on various planets as well as travel time between planets.  In main, use vectors to hold planet names, distance from the sun, and the specific gravity on each planet.  These are parallel vectors, so that the information at a position in each vector refers to information concerning the same planet.

 

Your program should first declare variables, include your vectors.

 

Display your course header with the program title and a brief introduction using a cout.  Load the data into the three vectors.  Start a do while loop as your Play loop. 

 

Ask for the user’s name, Earth weight, the speed they want to travel and the planet they wish to visit.  You will need to provide a menu with the planet names and a way for the user to select the chosen destination.

 

Your interaction with the user should look similar to this:

 

 

Using the data you have obtained from the user, determine the user’s weight on the destination planet and the travel time in hours. 

 

These equations might be useful:

Weight on New Planet = Weight on Earth * Relative Surface Gravity of New Planet

Travel Time (hours) = Travel Distance (miles) / Speed of Travel(mph)

 

 

Use the data in this table to load the arrays:

 

Planet

Distance from Sun (millions of miles)

Surface Gravity as a Percent of Earth’s Gravity

Mercury

36

0.27

Venus

67

0.86

Earth

93

1.00

Mars

141

0.37

Jupiter

483

2.64

Saturn

886

1.17

Uranus

1782

0.92

Neptune

2793

1.44

 

Display the traveler’s name, weight on Earth, the destination planet and weight on that planet.   Also report travel time results:  Break down the travel time into years, days and hours.  You may use 24 hours in a day and 365 days in a year (ignore leap years).  Display the number of years, days and hours required for the trip.

 

Your program should have only one set of result variables.  The code for the calculations and resultant output should be written in only one place in your program.  Do not duplicate code and calculation for each planet.  Make your program as efficient as possible without losing clarity.

 

Ask the user if they would like to calculate another space trip.  Remember to tell the user the choices for an answer.  If they say yes, loop up to the top of the Play Loop.  When the user is done, present a good-bye message.

 

Set the precision, etc, so you are reporting floating point numbers with 2 decimal places.

 

Use functions to get information from the user, fill vectors, complete calculations and display menus and final report.

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education