// JRobo    Example 5
//          Demonstrates wallet class
// Author:  David 4/9/99

import java.awt.*;
import java.applet.*;

public class WalletTest extends Applet
{

    public void paint( Graphics g )
    {

        // get a new wallet
        Wallet aWallet = new Wallet( "David" );
        
        aWallet.receive( 150 );  // put some money in it
        aWallet.payOut( 25 );    // then buy something

        // see current contents of wallet
        System.out.print( "Wallet owned by " + aWallet.getOwnerName(  ) );
        System.out.println( " now contains $" + aWallet.getCash(  ) );


        // try to spend too much!
        boolean ok = aWallet.payOut( 500 );
        if ( ok )
            System.out.println( "OK, paid out $500!" );
        else
            System.out.println( "Not OK, unable to pay out $500!" );
       
        // see current contents of wallet
        System.out.print( "Wallet owned by " + aWallet.getOwnerName(  ) );
        System.out.println( " now contains $" + aWallet.getCash(  ) );
    }

} // end WalletTest class