-- Demonstrates a fixed point type and a range constraint

with ada.text_io; use ada.text_io;             -- Library for text output
 
procedure one_v3  is 

    -- Define a new type for Money.
    -- All values of type Money will have exactly 2 decimal places
    type Money is delta 0.01 digits 9;

    -- Since Money is a new type, we need to create a new I/O library for it
    package money_io is new ada.text_io.decimal_io(money);
    use money_io;  -- Allow access to routines without using package name
    
    penny: money := 0.01;
    change_in_coins: money range 0.00 .. 0.99 := 0.0;  -- Limit possible values
begin

    for i in 1 .. 100 loop 
        change_in_coins := change_in_coins + penny;  -- Logic error.  What happens?!
    end loop;

    put("change_in_coins: ");
    money_io.put(change_in_coins);      
    new_line;

end one_v3;