Quantity
Part of the First Programs section of Coddy's COBOL Programming journey. Lesson 17 of 19.
Challenge
EasyRead a quantity into QTY after the price, and show it before the price: Coffee 03 x 004.50.
Example input, one line per ACCEPT: Coffee, 4.50, 3.
Try it yourself
IDENTIFICATION DIVISION.
PROGRAM-ID. RECEIPT.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 ITEM PIC X(12).
01 PRICE PIC 9(3)V99.
01 QTY PIC 99.
01 LINE-TOTAL PIC 9(4)V99.
01 TAX PIC 9(4)V99.
01 TOTAL PIC 9(4)V99.
01 PRICE-OUT PIC 9(3).99.
01 MONEY-OUT PIC 9(4).99.
PROCEDURE DIVISION.
ACCEPT ITEM.
ACCEPT PRICE.
MOVE PRICE TO PRICE-OUT.
*> Read QTY here, then change the DISPLAY
DISPLAY ITEM " " PRICE-OUT.
STOP RUN.