Line Total
Part of the First Programs section of Coddy's COBOL Programming journey. Lesson 18 of 19.
Challenge
EasyCompute LINE-TOTAL as the quantity times the price and add it to the line: Coffee 03 x 004.50 = 0013.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.
ACCEPT QTY.
*> Compute LINE-TOTAL here
DISPLAY ITEM QTY " x " PRICE-OUT.
STOP RUN.