-- enumio.adb a sample to demonstrate input and output of -- enumeration type data, and using the case structure -- The names of four transactions are defined as an Ada enumeration -- type. i.e. a user chosen set of english words that can be input, -- output, and recognized. In Ada these are not the same as character -- strings. -- Bank_Transactions can be OPEN Close deposit WithDraw with Ada.Text_IO ; use Ada.Text_IO ; procedure Enumio is type Bank_Transactions is ( Open , Close , Deposit , Withdraw ) ; package ENU_IO is new Enumeration_IO ( Bank_Transactions ) ; use ENU_IO ; Transaction : Bank_Transactions ; begin loop Put_Line ( " Enter transaction. " ) ; Get ( Transaction ) ; Put ( Transaction ) ; Put_Line ( " transaction being processed" ) ; case Transaction is -- case rather than "if" statement when Open => Put_Line ( " opening " ) ; when Close => Put_Line ( " closing " ) ; when Deposit => Put_Line ( " depositing " ) ; when Withdraw => Put_Line ( " withdrawing " ) ; end case ; end loop ; end Enumio ; -- Enter transaction. -- OPEN transaction being processed -- opening -- Enter transaction. -- DEPOSIT transaction being processed -- depositing -- Enter transaction. -- WITHDRAW transaction being processed -- withdrawing -- Enter transaction. -- CLOSE transaction being processed -- closing -- Enter transaction. -- OPEN transaction being processed -- opening -- Enter transaction. -- raised ADA.IO_EXCEPTIONS.DATA_ERROR -- JUNK raised an exception