Planet: Based on the information given in tablebelow, write: •a class called Planetthat contains information (only for data members mass, diameterand density) presented in the Planetary Data. •a default constructor to initialize every data member. •a member function called setInfo(...) to set the values for all data member. •a member function called printInfo(...) that will output all information about the planet. Set this member function as const. •a main function that will simulate the instantiation of a class Planet’sobject called Mercuryand set its information according to the data in figure below. •Then, print the information about Mercuryusing printInfo(...). Save your file as MatricNo_Planet.py NOTE: i need (#) comment and explanation
Planet:
Based on the information given in tablebelow, write:
•a class called Planetthat contains information (only for data members mass, diameterand density) presented in the Planetary Data.
•a default constructor to initialize every data member.
•a member function called setInfo(...) to set the values for all data member.
•a member function called printInfo(...) that will output all information about the planet. Set this member function as const.
•a main function that will simulate the instantiation of a class Planet’sobject called Mercuryand set its information according to the data in figure below.
•Then, print the information about Mercuryusing printInfo(...).
Save your file as MatricNo_Planet.py
NOTE: i need (#) comment and explanation
Step by step
Solved in 3 steps with 1 images