Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. program-id. Program1 as "CARINT.Program1".
  2.  
  3. data division.
  4.  
  5.  
  6. working-storage section.
  7. 01 loopF pic x value "y".
  8.  
  9. 01 ct pic xxxxxxxxxxxx.
  10. 01 custName pic x(20).
  11. 01 init pic x.
  12. 01 carT pic x.
  13. 01 mile pic 99999.
  14. 01 daysR pic 999.
  15.  
  16. 01 df pic 99.
  17. 01 mf pic 99.
  18.  
  19. 01 milesT pic 99999.99.
  20. 01 dayTo pic 99999.99.
  21. 01 total pic zzzzzzz.99.
  22.  
  23. 01 dt pic 99999V99.
  24. 01 mt pic 99999V99.
  25.  
  26.  
  27. screen section.
  28. 01 FirstS.
  29. 05 beg
  30. blank screen
  31. foreground-color 15
  32. background-color 2.
  33. 05 line 1 column 1 value "Name".
  34. 05 col 6 pic x(20) to custName.
  35. 05 line 2 col 2 value "Initiales".
  36. 05 col 12 pic x to init.
  37. 05 line 3 col 1 value "Car type (1 2 or 3)".
  38. 05 col 30 pic 9 to carT.
  39. 05 line 4 col 1 value "Enter Miles".
  40. 05 col 15 pic 99999.99 to mile.
  41. 05 line 5 col 1 value "Enter days rented:".
  42. 05 col 26 pic 999 to daysR.
  43. 05 line 6 col 30 value "----------------------".
  44.  
  45.  
  46.  
  47.  
  48. 01 LoopScreen.
  49. 05 line 9 col 1 value "Want to continue".
  50. 05 col 21 pic x to loopF.
  51.  
  52.  
  53.  
  54. procedure division.
  55.  
  56. 100Main.
  57. perform until loopF = "n"
  58. display FirstS
  59. accept FirstS
  60.  
  61. perform 200IF
  62. perform 400Cal
  63. display " "
  64. display " "
  65. display custName " " init " " ct " " mile " " daysR
  66. display total " " dayTo " " milesT
  67.  
  68. display LoopScreen
  69. accept LoopScreen
  70. end-perform
  71. stop run.
  72.  
  73. 500MainOld.
  74. perform until loopF = "n"
  75.  
  76. display "Name"
  77. accept custName
  78.  
  79. display "Enter init"
  80. accept init
  81.  
  82. display "Enter car Type"
  83. accept carT
  84. perform 200IF
  85.  
  86. display "Enter mile"
  87. accept mile
  88.  
  89. display "Enter day"
  90. accept daysR
  91.  
  92. perform 400CAL
  93.  
  94. display custName " " init " " ct " " mile " " daysR
  95. display total " " dayTo " " milesT
  96.  
  97.  
  98. display "Again??"
  99. accept loopF
  100. end-perform.
  101.  
  102.  
  103.  
  104.  
  105. 200IF.
  106. if carT not equal "1" or cart not equal "2" or cart not equal "3"
  107. move "ERROR" to ct
  108. move 0 to df
  109. move 0 to mf
  110. end-if.
  111. if carT is equal "1"
  112.  
  113. move "Toyota1" to ct
  114. move 26 to df
  115. move 18 to mf
  116. end-if
  117. if carT is equal "2"
  118.  
  119. move "Chevrolet2" to ct
  120. move 32 to df
  121. move 22 to mf
  122. end-if
  123. if carT is equal "3"
  124. move "Cadilla3" to ct
  125. move 43 to df
  126. move 28 to mf
  127. end-if.
  128.  
  129. 400CAL.
  130. compute mt rounded = (mf * mile) /100
  131. compute dt rounded = daysR * df
  132. compute total rounded = dt + mt
  133. move dt to dayTo
  134. move mt to milesT.
  135.  
  136. end program Program1.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement