Computers in Engineering WWW Site - Example 1.4

Example 1.4


FORTRAN Version

!
      PROGRAM P14
!
!
!     THIS PROGRAM SHOWS A
!     MORE COMPLEX NUMERIC
!     CALCULATION
!     $10 with 7% tax and then 6.5% tax
!
      IMPLICIT NONE
      PRINT *, 'This is Program >> P14  - Prints a tax calculation'
!
!
      PRINT *,'Total cost of $10.00 item with 2 taxes'
      PRINT *, 10.0 * ( 1.0 + 0.07)  &  ! long line broken up
               * (1.0 + 0.065)          ! this is a continuation
      STOP 
      END PROGRAM P14
OUTPUT:

              +--------------------------------------------------+
              |     32-bit Power for Lahey Computer Systems      |
              |   Phar Lap's 386|DOS-Extender(tm) Version 7.0    |
              |  Copyright (C) 1986-94 Phar Lap Software, Inc.   |
              |           Available Memory = 14880 Kb            |
              +--------------------------------------------------+


This is Program >> P14  - Prints a tax calculation
Total cost of $10.00 item with 2 taxes
    11.3955    

Pascal Version

{
     This program shows a more complex numeric calculation
}
PROGRAM p14 (input, output);
BEGIN
  writeln ('total cost of $10.00 item');
  writeln (10.0 * (1.0 + 0.12) * (1.0 + 0.08))
END.

Last modified: 21/07/97