AdaCore University

Stars 05 - Subprograms

Download Lab Files


  • Replace the use of an enumeration to describe stars by an integer type.

    Implement a Create_Star subprogram, with the following profile:

    function Create_Star
         (Size : Float;
          Color : Color_Type;
          Speed : Float;
          Turns_Around : Star_Index;
          Distance : Float) return Star;

    Use it for initializing the various stars in the system. Then implement a Move_Around subprogram, with the following profile:

    procedure Move_Around (The_Star : in out Star; Around : Star);

    Use it to move balls instead of doing all computation in the main loop

  • Implement a new star, representing a comet rotating around the Sun.