Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Exercise # ex2_2 1. Create a new text file named ex2_2.cpp with the following two lines. Be sure to replace the string YourFullName with

image text in transcribed
Programming Exercise # ex2_2 1. Create a new text file named "ex2_2.cpp" with the following two lines. Be sure to replace the string "YourFullName" with your real full name. /*Filename: ex2_2.cpp Student: Your FullName / 2. Next to the above two lines, write a C++ program that will define a constant named "light_speed" whose value is 1.86x10 miles/second. Be sure to choose the proper data type for the "light_speed" constant. 3. Write C++ codes to create three variables named "sun", "sat", and "mar", and assign the distances from Sun, Saturn, and Mars to the Earth as values. The following table lists the distances. Be sure to choose the proper data type(s) for the "sun", "sat", and "mar" variables. Distance Value Variable name Sun to Earth 9.3x10 miles Saturn to Earth 8.92*10 miles Mars to Earth 1.494x10 miles 4. The number of years it takes from a planet to earth can be computed using the following formula. number of years distant from a planet to earth value of light year 5. Write C++ codes to compute the number of years it takes to travel from Sun to Earth, from Saturn to Earth, and from Mars to Earth. Be sure to add (concatenate) string literal like "Sun to earth: "Saturn to earth, and "Mars to earth: " to the computed values, then display the out that looks similar to the following Sun Sat mar Developer F:\csc1123\x22 Sun to earth: See Saturn to earth: 4795.7 Mars to earth: 803.226

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

ISBN: 0805360476, 978-0805360479

More Books

Students also viewed these Databases questions