-- This program calculates the number of years it would
-- take for invested capital to exceed 100000 at 9.25% interest
with Ada.Text_Io, Ada.Float_Text_Io, Ada.Integer_Text_Io;
use Ada.Text_Io, Ada.Float_Text_Io, Ada.Integer_Text_Io;
-- Ada 95: From The Beginning
-- Chapter 2, Problem 10
procedure Ch2Problem10 is
   Capital : Float   := 0.0;
   Interest: Float   := 0.0925;
   Years   : Integer := 0;
begin
   Put("Enter beginning balance: ");
   Get(Capital);

   if( Capital <= 0.0 ) then
      Put("Accounts must have a positive balance for interest.");
      return;
   end if;

   while Capital < 100000.0 loop
      Capital := Capital + (Capital * Interest);
      Years   := Years + 1;
   end loop;

   Put("Years to $100000.00: "); Put(Years); New_Line;
end Ch2Problem10;