
I need this
#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;}

Step by stepSolved in 2 steps with 1 images

- An application that uses user-defined functions has to provide function prototypes.arrow_forwardNested function classwork 2 Write 'taxIncome', a user-defined function that calculates income tax. y = taxincome (income) defines the principal function. The main function calculates adjusted income as income - 6000. Then y = compute Tax is called. For y = 0.28*Adjusted Income, this function uses 'Adjusted Income'. 'Adjusted Income' was defined in the main function. Use $80,000 income.arrow_forwardThe term function call refers to running the function. Which lines of code does your group think calls the DonationTimeLeft function? Write the line numbers below.arrow_forward
- Set-up and implementation code for a void function MaxYou are not required to write a complete C++ program but must write and submit just your responses to the four specific function related questions below: QC1: Write the heading for a void function called Max that has three intparameters: num1, num2 and greatest. The first two parameters receive data from the caller, and greatest is used to return a value as a reference parameter. Document the data flow of the parameters with appropriate comments*. QC2: Write the function prototype for the function in QC1. QC3: Write the function definition of the function in QC1 so that it returns the greatest of the two input parameters via greatest, a reference parameter. QC4: Add comments to the function definition* you wrote in QC3 that also states its precondition and postcondition.arrow_forwardC++arrow_forward1. It should contain a function prototype for function myname. The function receives a reference variable in the parameter list and returns void. The function myname will do the following:1.1 Create a name string variable in the main function and initialize it with your full name as a string literal. Create a prototype indicating void return from the function and using pass by reference. Pass a reference to the name variable when calling the function in the main function.1.2 The myname function use the reference variable in cout to print: Student Name: "full name that references the name string variable in the main function."1.3 Advance to next line at the end of cout in the function.2. In the main function of the C++ program, code program statements to do 2.3-2.9:2.1 Download the attached savings.txt file.2.2 Save the savings.txt file to a location on your computer where the program can read it.2.3 The program should prompt to enter the filename. Save the filename to a variable and…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





