with Ada.Text_IO; use Ada.Text_IO;
with Ada.Numerics; use Ada.Numerics;
with Accounts; use Accounts;
with Motion; use Motion;

procedure Main is
   L : constant Ledger := (100.0, 250.5, 12.34, 0.07, 99_999.99, 0.0);
   R : constant Rate := 0.0325;
   Grown : Money;
   Cents : Money := 0.0;
   Meters : Float;

   --  a distance in money: GNATprove 16.1 does not support conversions between fixed and
   --  floating point yet, so it skips this body (Verada proves it)
   procedure Show_In_Money (M : Float)
     with Pre => M in 0.0 .. 1000.0, Global => (In_Out => File_System);

   procedure Show_In_Money (M : Float) with SPARK_Mode => Off is
      C : Money := Money (M);
   begin
      C := C - C / 3;
      Put_Line (Money'Image (C) & Money'Image (Money (M) / 2) & Money'Image (Money (C * R)));
   end Show_In_Money;
begin
   for I in L'Range loop
      Grown := L (I) + Interest (L (I), R);
      Put_Line (Integer'Image (I) & Money'Image (Grown) & Money'Image (Share (L (I), 3)));
   end loop;
   Put_Line (Money'Image (Total (L)) & Integer'Image (Whole_Units (12.5)) & Integer'Image (Whole_Units (-12.5)));
   for Step in 1 .. 4 loop
      Cents := Cents + Money (Step) / 3;
      pragma Loop_Invariant (Cents in 0.0 .. Money (2 * Step));
   end loop;
   Put_Line (Money'Image (Cents) & Rate'Image (R) & Integer'Image (Rate'Aft) & Money'Image (Money'Small));
   Meters := Flight_Range (20.0, Pi / 4.0);
   if Meters in 0.0 .. 1000.0 then
      Put_Line (Float'Image (Meters) & Integer'Image (Integer (Meters)) & Float'Image (Float'Floor (Meters)));
      Show_In_Money (Meters);
      Put_Line (Float'Image (Float'Rounding (Meters * 10.0) / 10.0));
   end if;
   Put_Line (Float'Image (Height (30.0)) & Float'Image (Hypotenuse (3.0, 4.0)));
end Main;
