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.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter8: Advanced Method Concepts
Section: Chapter Questions
Problem 8RQ
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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage