Item and Price
Part of the First Programs section of Coddy's COBOL Programming journey. Lesson 16 of 19.
Challenge
EasyA receipt line starts with an item and its price. Read ITEM and then PRICE, and display them as Coffee 004.50: the item, a space, then PRICE-OUT.
Example input, one line per ACCEPT: Coffee, 4.50.
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.
*> Read ITEM and PRICE, then display them
STOP RUN.