Question
CODE IN C PLEASE You are to write a program to read this data from the txt file planets.txt which is attached to the assignment.
CODE IN C PLEASE
You are to write a program to read this data from the txt file planets.txt which is attached to the assignment. The blanks in the left label column are entered as _ in the txt file for ease of input. They should be converted to blanks for the output by your program. Note that you should put the file planets.txt in your project folder for this program.
Do not put it in the src or debug subfolders. Your program is to read the data and print the table with the planets and all associated data ordered from left to right by descending order of density. Do not print the input data as it is read, i.e. your program produces one table.
Your table should look similar to the one above but of course the planets will be in a different order. Your program is to also store the sorted table in a new csv file called sortedPlanets.csv which should be created in the project folder for this project. Note that csv is a text file format where the data fields are separated by commas. You should study the format of the csv file before starting (see for example https://en.wikipedia.org/wiki/Comma-separated_values ). Make sure your csv file will open in Excel.
MERCURY VENUS EARTH MARS JUPITER SATURN URANUS NEPTUNE PLUTO Mass(10^24kg) 0.33 4.87 5.97 0.642 1898 568 86.8 102 0.0146 Diameter(km) 4879 12104 12756 6792 142984 120536 51118 49528 2370 Density(kg/m^3) 5427 5243 5514 3933 1326 687 1271 1638 2095 Gravity(m/s^2) 3.7 8.9 9.8 3.7 23.1 9 8.7 11 0.7 Escape_Velocity(km/s) 4.3 10.4 11.2 5 59.5 35.5 21.3 23.5 1.3 Rotation_Period(hours) 1407.6 -5832.5 23.9 24.6 9.9 10.7 -17.2 16.1 -153.3 Length_of_Day(hours) 4222.6 2802 24 24.7 9.9 10.7 17.2 16.1 153.3 Distance_from_Sun(106km) 57.9 108.2 149.6 227.9 778.6 1433.5 2872.5 4495.1 5906.4 Perihelion(106km) 46 107.5 147.1 206.6 740.5 1352.6 2741.3 4444.5 4436.8 Aphelion(106km) 69.8 108.9 152.1 249.2 816.6 1514.5 3003.6 4545.7 7375.9 Orbital_Period(days) 88 224.7 365.2 687 4331 10747 30589 59800 90560 Orbital_Velocity(km/s) 47.4 35 29.8 24.1 13.1 9.7 6.8 5.4 4.7 Orbital_Inclination(degrees) 7 3.4 0 1.9 1.3 2.5 0.8 1.8 17.2 Orbital_Eccentricity 0.205 0.007 0.017 0.094 0.049 0.057 0.046 0.011 0.244 Obliquity_to_Orbit(degrees) 0.01 177.4 23.4 25.2 3.1 26.7 97.8 28.3 122.5 Mean_Temperature(C) 167 464 15 -65 -110 -140 -195 -200 -225 Surface_Pressure(bars) 0 92 1 0.01 Unknown* Unknown* Unknown* Unknown* 0 Number_of_Moons 0 0 1 2 67 62 27 14 5 Ring_System? No No No No Yes Yes Yes Yes No Global_Magnetic_Field? Yes No Yes No Yes Yes Yes Yes UnknownProblem 4 Consider the information in the following table (note Pluto is included even though it has been downgraded from planetary status) MERCURY VENUS EARTH MARS JUPITER SATURN URANUS NEPTUNE PLUTO Mass (1024kg) 0.642 1898 0.0146 Diameter (km) 4879 12104 12756 6792 142984 120536 51118 49528 2370 Density (kg/m 3) 5427 5243 5514 3933 1326 687 1271 1638 2095 Gravity (m/sA 2) 3.7 8.9 9.8 3.7 23.1 9 8.7 11 0.7 43 10.4 11.2 5 59.5 35.5 21.3 23.5 1.3 Escape Velocity (km/s) 1407.6 -5832.5 23.9 24.6 9.9 10.7 -17.2 16.1 -153.3 Rotation Period(hours) Length of Day (hours) 4222.6 2802 24 24.7 9.9 10.7 17.2 16.1 153.3 Distance from Sun(106km) 57.9 108.2 149.6 227.9 778.6 1433.5 2872.5 4495.1 5906.4 46 107.5 147.1 206.6 7405 1352.6 2741.3 4444.5 4436.8 Perihelion (106km). Aphelion (106km) 69.8 108.9 152.1 249.2 816.6 1514.5 3003.6 4545.7 7375.9 88 224.7 365.2 687 4331 10747 30589 59800 90560 Orbital Period(days) orbital velocity (km/s) orbital Inclination (degrees) 7 3.4 o 1.9 1.3 2.5 0.8 1.8 17.2 orbital Eccentricity 0.205 0.007 0.017 0.094 0.049 0.057 0.046 0.011 0.244 obliquity to orbit degrees) 0.01 177.4 23.4 25.2 3.1 26.7 97.8 28.3 122.5 464 15 -65 110 -140 -195 -200 -225 167 Mean Temperature(C) o 92 1 0.01 Unknown Unknown Unknown Unknown o Surface Pressure (bars) o 0 1 2 67 62 27 14 5 Number of Moons No No No No Yes Yes Yes Yes No Ring System? Yes No Yes No Yes Yes Yes Yes Unknown Global Magnetic Field? which is taken from http:/ssdc.gsfc.nasa.gov/planetary/factsheet/ The symbol A denotes to the power of 24 e.g. 10A24 means 10
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started