home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / STEN / STEN10.MSA / PROGRAMS / PASCAL / COMISION.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  2010-04-21  |  1.2 KB  |  48 lines

  1. PROGRAM Earning_Commision;
  2. {       This program, written by
  3.         Roy McPartland, asks the
  4.         user to input a product's
  5.         code, then calculates the
  6.         salesperson's commision.
  7.         20/11/91                     }
  8.  
  9. USES
  10.     CRT;
  11.  
  12. VAR
  13.      Input_Code : Char;
  14.      Commision  : Real;
  15.      Input_Sale : Real;
  16.  
  17. PROCEDURE Input_The_Product;
  18.      BEGIN
  19.          CLRSCR;
  20.          WRITELN ('Please enter the value of the sale');
  21.          READLN (Input_Sale);
  22.          WRITELN ('Now enter the product code');
  23.          READLN (Input_Code);
  24.      END;
  25.  
  26. PROCEDURE Calculations;
  27.      BEGIN
  28.           CASE (Input_Code) OF
  29.           'A' : Commision := Input_Sale * 0.05;
  30.           'B' : Commision := Input_Sale * 0.10;
  31.           'C' : Commision := Input_Sale * 0.15;
  32.           'D' : Commision := Input_Sale * 0.175;
  33.           'E' : Commision := Input_Sale * 0.2;
  34.           END;
  35.      END;
  36.  
  37. PROCEDURE Display_Answers;
  38.      BEGIN
  39.          CLRSCR;
  40.          WRITELN ('The sale of £',Input_Sale:3:2,' has earned a commision of £',
  41.             Commision:3:2);
  42.      END;
  43.  
  44. BEGIN
  45.     Input_The_Product;
  46.     Calculations;
  47.     Display_Answers;
  48. END.ə