!------------------------------------------------------------------------------
!
!  Program name:
!
!    money_main
!
!  Purpose:
!
!    This program uses the money module and shows how to apply all 
!    associated operators and assignment overloading to the 
!    variables of derived type money.
!
!------------------------------------------------------------------------------

PROGRAM money_main

  USE money_module

  IMPLICIT NONE  
  TYPE (money) :: price, tax, net, checkprice, zero

  price = money(99, 99)

  ! Use new assignment (excluding pence):

  tax = price%pounds * vatrate
  WRITE(*,*) 'tax1 = ', tax
  
  ! Use new operator .VAT.:

  tax = .VAT. price
  WRITE(*,*) 'tax2 = ', tax

  ! Use new money operators:

  net = price - tax
  WRITE(*,*) 'Net price = ', net

  checkprice = net + tax
  WRITE(*,*) 'net + tax = ', checkprice

  zero = price + (-checkprice)
  WRITE(*,*) 'Check zero: ', zero

END PROGRAM money_main
