Question

In: Computer Science

Our weight on different planets in the solar system will differ due to the varying size...

Our weight on different planets in the solar system will differ due to the varying size and mass of each of the planets. Write a C program, weight.c, to compute the weight of a 200 pound person on the following planets, based on the data below:
 
 
Planet  Percent of Earth Weigh ------  ------------------------ Mercury               37.8% Venus       90.7% Mars        37.7% Jupiter                   236.0% Saturn      91.6% Uranus      88.9% Neptune     112.0%
 
 
 
The program should generate the following outputs:
 
 
Mercury: xxx.x   Venus: xxx.x    Mars: xxx.x Jupiter: xxx.x  Saturn: xxx.x  Uranus: xxx.x Neptune: xxx.x
 
 
 
Your program should right-justify the planet names and present the output to one decimal place as shown above. Be sure to line up the decimal points. Use the following guidelines to develop your program:
 
 
Declare your variables with appropriate data types.
 Assign values to your variables.
 Perform your calculations.
 Generate appropriate output.
 
 
Points to Remember:  
Make sure you are creating a C program and not a C++ program. The .c suffix to your source code will invoke the C compiler while the .cpp suffix will invoke the C++ compile

Solutions

Expert Solution

Program

#include<stdio.h>
int main()
{   
    float weight=200;//weight in pound on earth   
    float mer_wt,ven_wt,mars_wt,jup_wt,sat_wt,urn_wt,nep_wt;  
    mer_wt=(37.8*weight)/100;
    ven_wt=(90.7*weight)/100;
    mars_wt=(37.7*weight)/100;
    jup_wt=(236.0*weight)/100;
    sat_wt=(91.6*weight)/100;
    urn_wt=(88.9*weight)/100;
    nep_wt=(112.0*weight)/100;
    printf("Weight of a 200 pound person in planet : ");
    printf("\n%10s%.1f","Mercury:",mer_wt);
    printf("\n%10s%.1f","Venus:",ven_wt);
    printf("\n%10s%.1f","Mars:",mars_wt);
    printf("\n%10s%.1f","Jupiter:",jup_wt);
    printf("\n%10s%.1f","Saturn:",sat_wt);
    printf("\n%10s%.1f","Uranus:",urn_wt);
    printf("\n%10s%.1f","Neptune:",nep_wt);

}

Output

Weight of a 200 pound person in planet :
Mercury:75.6
    Venus:181.4
     Mars:75.4
Jupiter:472.0
   Saturn:183.2
   Uranus:177.8
Neptune:224.0


Related Solutions

Python Programming You can calculate a person’s weight on the different planets within our solar system...
Python Programming You can calculate a person’s weight on the different planets within our solar system by multiplying their mass by the gravity factor on the surface of the planet. Weight = Earth Weight x Surface Gravity Factor Planet Surface Gravity Factor Mercury 0.38 Venus 0.91 Moon 0.165 Mars 0.38 Jupiter 2.34 Saturn 0.93 Uranus 0.92 Neptune 1.12 Pluto 0.066 \ For example if you weigh 100 pounds on earth on Mars you would be: Mars Weight 38 = 100...
2. There are 8 confirmed planets in our solar system. The number of significant figures in...
2. There are 8 confirmed planets in our solar system. The number of significant figures in this number is 1. True or False? Explain. 3 Do the following calculations, reporting the correct number of significant figures in your answer. a) 6.53x10^3g/12.8mL b) 5.621mL+ 22.4mL+5mL c) 3.3mm x 23.4mm x 1.769mm d) (965.43 x 3.911)+ 9413.4136 4. Preform the following conversions, reporting the correct number of significant figures in your answers. a) 1.976 x 10^-3 g to micro g b) 1.25...
Discuss the formation of the solar system. List the planets of the solar system, discussing their...
Discuss the formation of the solar system. List the planets of the solar system, discussing their properties, attributes, and missions that explored them.
I.       According to Kepler’s Law, the planets in our solar system move in elliptical orbits around...
I.       According to Kepler’s Law, the planets in our solar system move in elliptical orbits around the Sun. If a planet’s closest approach to the Sun occurs at t = 0, then the distance r from the center of the planet to the center of the Sun at some later time t can be determined from the equation r = a (1 – e cos f) where a is the average distance between centers, e is a positive constant that...
Create an enumeration named Planet that holds the names for the eight planets in our solar...
Create an enumeration named Planet that holds the names for the eight planets in our solar system, starting with MERCURY equal to 1 and ending with NEPTUNE. Write a program named Planets that prompts the user for a numeric position, and display the name of the planet that is in the requested position. For example, if 3 is input, the output would be: EARTH is 3 planet(s) from the sun Answer in C# (Posting incomplete and probably wrong code that...
the Sun displays limb darkening. For all the planets in the solar system, predict whether or...
the Sun displays limb darkening. For all the planets in the solar system, predict whether or not you expect to also observe limb darkening . Explain your predictions.
Description: Our solar system is very diverse when it comes to the gas composition on our...
Description: Our solar system is very diverse when it comes to the gas composition on our planets. On Mercury, which has almost no atmosphere, the pressure is less than 10-14 bar. Venus on the other hand has a much more dense atmosphere than earth, with a pressure of 92 bar. Instructions: Write a response to the following prompt and then respond to your peers. Would having different atmospheric pressures have an effect on the accuracy of gas laws? If so,...
Is every galaxy in the universe rotating in the same way as our solar system?
Is every galaxy in the universe rotating in the same way as our solar system?
1. About 1 in 5 solar systems outside of our solar system has an Earth-sized planet...
1. About 1 in 5 solar systems outside of our solar system has an Earth-sized planet that could support life as we know it. true false 2. A major factor in the spread of transspecies hybrid viruses is A. lack of vaccines against these novel viruses B. host organisms lack antibodies against these novel pathogens C. there is no herd immunity against novel pathogens D. all of the above 9. The Drake Equation describes the odds of finding intelligent life...
1. About 1 in 5 solar systems outside of our solar system has an Earth-sized planet...
1. About 1 in 5 solar systems outside of our solar system has an Earth-sized planet that could support life as we know it. true false 2. A major factor in the spread of transspecies hybrid viruses is A. lack of vaccines against these novel viruses B. host organisms lack antibodies against these novel pathogens C. there is no herd immunity against novel pathogens D. all of the above 9. The Drake Equation describes the odds of finding intelligent life...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT