Question: 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
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
Get step-by-step solutions from verified subject matter experts
