I need this program to have function prototype, calling and function definition. I also need to keep the switch function  #include using namespace std; int main()     {         int number;         cout << "Astronomy Helper" <> number;         cout <= 1 && number <=5)//if choice between 1-4         {                 switch (number)                 {                 case 1: //user chooses option 1, calculate area of circle                         cout << "Mercury" << endl;                         cout<< "Average distance from sun: 57.9 million kilometers"<

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

I need this program to have function prototype, calling and function definition. I also need to keep the switch function 

#include <iostream>

using namespace std;

int main()
    {
        int number;
        cout << "Astronomy Helper" <<endl;
        cout <<endl;
        cout << "Menu Selection" << endl;
        cout << "1. Mercury" << endl;
        cout << "2. Venus" << endl;
        cout << "3. Earth" << endl;
        cout << "4. Mars" << endl;
        cout << "5. End the Program" << endl;
        cout << "Enter your selection [1 - 5]: ";
        cin >> number;
        cout <<endl;

        if (number >= 1 && number <=5)//if choice between 1-4
        {
                switch (number)
                {
                case 1: //user chooses option 1, calculate area of circle
                        cout << "Mercury" << endl;
                        cout<< "Average distance from sun: 57.9 million kilometers"<<endl;
                        cout << "Mass: 3.31 x 10^23 kg" <<endl;
                        cout << "Surface Temperature: -173 to 430 degrees Celsius" << endl;

                    break;

                case 2://user chooses option 2, calculate area of rectangle
                        cout << "Venus" << endl;
                        cout<< "Average distance from sun: 108.2 million kilometers"<<endl;
                        cout << "Mass: 4.87 x 10^24 kg" <<endl;
                        cout << "Surface Temperature: 472 degrees Celsius" << endl;

                        break;

                case 3:
                        cout << "Earth" << endl;
                        cout<< "Average distance from sun: 149.6 million kilometers"<<endl;
                        cout << "Mass: 5.967 x 10^24 kg" <<endl;
                        cout << "Surface Temperature: -50 to 50 degrees Celsius" << endl;

                       break;

                case 4:
                        cout << "Mars" << endl;
                        cout<< "Average distance from sun: 227.9 million kilometers"<<endl;
                        cout << "Mass: 0.6424 x 10^24 kg" <<endl;
                        cout << "Surface Temperature: -140 to 20 degrees Celsius" << endl;
                    break;

                case 5:
                        cout <<"Thank you! This program will end now!" <<endl;
                    break;
                }

        }
        else if (number != 5)//if users choice not 1-4, terminate program
    {

                cout << "ERROR! The valid choices are only 1-4!\n";
                cout << "Please run the program again.\n";
    }

            return 0;}

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Concept of Parenthesis
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
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