Advertisement
Guest User

Untitled

a guest
Oct 11th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
COBOL 2.61 KB | None | 0 0
  1. program-id. Program1 as "ConsoleApplication8.Program1".
  2.        environment division .
  3.        input-output section.
  4.        file-control.  select input-file assign to "" organization is line sequential.
  5.                
  6.        data division.
  7.        file section.
  8.        fd input-file.
  9.        
  10.        01 customer-rec.
  11.            05 CustName pic x(20).
  12.            05 FirstIn pic x.
  13.            05 car-type pic x.
  14.                88 Toyota value '1'.
  15.                88 Chevrolet value '2'.
  16.                88 Cadillac value '3'.
  17.            05 Mile pic 9(5).
  18.            05 NoDaysRent pic 999.
  19.            05 Bill pic $9(3).9(2).
  20.        
  21.        
  22.        
  23.        working-storage section.
  24.        
  25.        
  26.        
  27.        01 Display-Bill.
  28.        05 CustName-o pic x(20).
  29.        05 TotalPrice-o pic $9(3)v99.
  30.        
  31.        
  32.        
  33.        
  34.        
  35.        
  36.        01 looploop pic x value "N".
  37.        
  38.        01 Toyota-Price-Day pic 99 value 26.
  39.        01 Chevrolet-Price-Day pic 99 value 32.
  40.        01 Cadillacs-Price-Day pic 99 value 43.
  41.        01 Toyota-Price-Mile pic v99 value .18.
  42.        01 Chevrolet-Price-Mile pic v99 value .22.
  43.        01 Cadillac-Price-Mile pic v99 value .28.
  44.        01 Distance-charged pic 9(4).
  45.        
  46.        01 TotalPrice pic 9(6)v99.
  47.        
  48.  
  49.        procedure division.
  50.        
  51.        200-CarType.
  52.        if Toyota  perform 300-Toyota.
  53.        if Chevrolet perform 400-Chevrolet.
  54.        if Cadillac perform 500-Cadillac.
  55.        
  56.        
  57.        
  58.        300-Toyota.
  59.        
  60.        compute TotalPrice= (Toyota-Price-Day*NoDaysRent)+(Toyota-Price-Mile*Mile).
  61.        if Mile>100 then
  62.            subtract 100 from Mile giving Distance-charged
  63.            compute TotalPrice= (Toyota-Price-Day*NoDaysRent)+(Toyota-Price-Mile*Distance-charged)
  64.        end-if.
  65.        
  66.        400-Chevrolet.
  67.        
  68.        compute TotalPrice= (Chevrolet-Price-Day*NoDaysRent)+(Chevrolet-Price-Mile*Mile).
  69.        if Mile>100 then
  70.        subtract 100 from Mile giving Distance-charged
  71.            compute TotalPrice= (Chevrolet-Price-Day*NoDaysRent)+(Chevrolet-Price-Day*Distance-charged)
  72.        end-if.
  73.        
  74.        500-Cadillac.
  75.        
  76.        
  77.        compute TotalPrice= (Cadillacs-Price-Day*NoDaysRent)+(Cadillac-Price-Mile*Mile).
  78.        if Mile>100 then
  79.        subtract 100 from Mile giving Distance-charged
  80.            compute TotalPrice= (Cadillacs-Price-Day*NoDaysRent)+(Cadillac-Price-Mile*Distance-charged)
  81.        end-if.
  82.        
  83.        move CustName to CustName-o.
  84.        move TotalPrice to TotalPrice-o.
  85.        
  86.        
  87.  
  88.            goback.
  89.            
  90.        end program Program1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement