Packages

The Solar_System API

The purpose of this exercise is to factor out the code for stars into a package.

_images/05_1.png

Expected result

Question 1

From the exercise Subprograms, the structures and subprograms are now declared in an external package, called Solar_System.

Implement the subprogram Move_All that moves all the objects of a solar system.

Use the Solar_System package to obtain a behavior similar to the exercise subprograms.

Question 2

Create a child package Graphics of Solar_System to handle graphical functionalities like Draw_Body procedure.

Implement in this package a procedure Draw_All that will call Draw_Body for each object.

Question 3

Create a black hole (not visible) rotating around the sun, and create two objects moving around that invisible point.