DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: B T

⟦9b1f78d11⟧ TextFile

    Length: 1884 (0x75c)
    Types: TextFile
    Names: »B«

Derivation

└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
    └─⟦5cb1d1d7f⟧ »DATA« 
        └─⟦3b1ee7bd8⟧ 
            └─⟦this⟧ 

TextFile

with String_Utilities;
package body Dollars_And_Cents is

    function Value (String_Image : String) return Dollars is
        Money : Dollars := 0;
        Decimal : Natural := String_Utilities.Locate (".", String_Image);
        Cents : Integer;
        Dollrs : Integer;
        Worked : Boolean;
    begin
        String_Utilities.String_To_Number
           (String_Image (String_Image'Last - 1 .. String_Image'Last),
            Cents, Worked);
        if String_Image (1) = '$' then
            String_Utilities.String_To_Number
               (String_Image (String_Image'First + 1 .. String_Image'Last - 3),
                Dollrs, Worked);
        else
            String_Utilities.String_To_Number
               (String_Image (String_Image'First .. String_Image'Last - 3),
                Dollrs, Worked);
        end if;

        return Dollars ((Dollrs * 100) + Cents);
    end Value;

    function Image (D : Dollars;  
                    Field_Width : Positive;  
                    Add_Dollar_Sign : Boolean := True) return String is
        Dollrs : Dollars := (D / 100);
        Cents : Dollars := D - Dollrs * 100;
        D_Imag : constant String := String_Utilities.Number_To_String
                                       (Integer (Dollrs), 10, Field_Width);
        C_Imag : constant String := String_Utilities.Number_To_String
                                       (Integer (Cents), 10, 2, '0');
    begin
        if Add_Dollar_Sign then
            return "$" & D_Imag & "." & C_Imag;
        else
            return D_Imag & "." & C_Imag;
        end if;
    end Image;

    function "+" (D1, D2 : Dollars) return Dollars is
    begin
        return Dollars (Integer (D1) + Integer (D2));
    end "+";

    function "-" (D1, D2 : Dollars) return Dollars is
    begin
        return Dollars (Integer (D1) - Integer (D2));
    end "-";
end Dollars_And_Cents;