Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A c++ coding problem. how to write the solarSystem.cpp and its main.cpp? Part 3:

ID: 3804561 • Letter: A

Question

A c++ coding problem.

how to write the solarSystem.cpp and its main.cpp?

Part 3: Solar System The last class you wi implement is called solarsystem. The solarsystem.hfile has been made available on Moodle. You will create your class file solarsystem.cpp. There is one constructor, one destructor, and five methods to create for the solarsystem class. One of the setter methods is an Add function. Use this method to populate the solar system arrays, one planet at a time. Use the planet class getter methods to access the data needed for the addPlanet0 method of solarsystem. Code is provided in main to test the implementation of your solarsystem class. The Part 3 code is inside of a comment block. Uncomment the comment block to unlock the Part 3 main code. When you have completed the implementation of the solarsystem class and included the solarsystem header file to the main file, the output of main should look like this The orbit of Mercury takes 0.24075 years. The diameter of Mercury is 4880 km Mercury is 0.387 AU from the Sun. The orbit of Venus takes 0.614763 years The diameter of Venus is 12 104 kim. Venus is 0.723 AU from the Sun. The orbit of Earth takes 1 years. The diameter of Earth is 12742 kim. Earth is 1 AU from the Sun. The orbit of Mars takes 1.88138 years. The diameter of Mars is 6780 km. Mars is 1.524 AU from the Sun. System name Sol Sol has 4 planets. The biggest planet is Earth The diameter of Sol is 3.048 AU.

Explanation / Answer

The given header file is not complete. With the functions specified there,
all you can get is the name of the largest planet and NOT ALL THE PLANETS,
diameter of largest orbit and NOT diameters of the orbits of all the planets.

There is no method provided to retrieve orbit distance.

Since the addPlanet method requires to use the getter methods,
there should be a way to set the names of planet i.e to populate planetNames[] before calling the addPlanet method.
This can be done either through constructor or setter methods.

As of now, the constructor input is only string and not array of strings.
So there should be a setter method to populate planetNames array. This is not provided.

Maybe you can enquire this with your Professor and repost the question here.