7.6 LAB: Planet Struct
Programming Tasks
1. Define the Planet struct with the following subitems (i.e. data members)
• char array name
• double radius (in miles)
• double mass (in kg)
2. Write the function CheckIsGiant() that takes in a Planet struct and returns a Boolean signifying whether or not the planet is "Giant,"
defined as more than 5 times earth's radius, which is 3959 miles.
3. Similarly, write the function CheckIsMassive() that takes in a Planet struct and returns a Boolean signifying whether or not the planet
is "Massive," defined as more than 10 times earth's mass, which is $5.972 \times 10^{24}$ kg. NOTE: when dealing with LARGE floating-point
numbers, it is best to use the scientific E notation. For example $5.972 \times 10^{24}$ can be easily entered in the code or as an input value
as 5.972e24 OR 5.972E24.
4. Write code in main() to declare a new Planet with name "Saturn", radius of 36184 miles, and mass of $5.683 \times 10^{26}$ kg. Then, call
CheckIsGiant() to check if this Planet is "Giant". Print either "Saturn is a Giant!" OR "Saturn is not a Giant." based on the returned value.
Then, call ChecklsMassive() to check if this Planet is "Massive". Print either "Saturn is Massive!" OR "Saturn is not Massive." based on
the returned value.
5. Finally, allow the user to enter in a the name, radius, and mass of a planet of their choice or imagination. Store the user-inputted
information in a Planet struct. Once again, make calls to CheckIsGiant() and CheckIsMassive() to determine the proper output.
Sample Input/Output
When the user enters PlanetX 4000.0 6.1e25, the output is:
Saturn is a Giant!
Saturn is Massive!
Enter the name of your planet:
Enter the radius in miles of PlanetX:
Enter the mass in kg of PlanetX:
PlanetX is not a Giant.
PlanetX is Massive!