Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.
Basic COBOL ~easy to understand~
This is the first part of two parts, also check out the ones i posted in cpp and vb.net they do the same thins as these.
IDENTIFICATION DIVISION.
PROGRAM-ID. ASSIGNMENT1.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 USER-KEY PIC X VALUE SPACES.
01 PERC PIC V99 VALUE .62.
01 PRESALE PIC 9(7) VALUE 4600000.
01 SALES PIC 9(7) VALUE 0.
PROCEDURE DIVISION.
DISPLAY "Predicted East Coast Sales $" LINE 1 COLUMN 1.
COMPUTE SALES = PERC * PRESALE.
DISPLAY SALES LINE 1 COLUMN 29.
DISPLAY "PRESS ANY KEY TO CONTINUE. . ." LINE 3 COLUMN 1.
ACCEPT USER-KEY LINE 3 COLUMN 33.
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. ASSIGNMENT2.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 USER-KEY PIC X VALUE SPACES.
01 PAMOUNT-IN PIC 9999V9 VALUE 1700.0.
01 PPERIOD-IN PIC 99 VALUE 26.
01 ANNUALPAY PIC 9(5) VALUE 0.
01 PAMOUNT-OUT PIC $$$$,$99.99.
01 ANNUALPAY-OUT PIC $$$$,$99.99.
PROCEDURE DIVISION.
DISPLAY "Amount of pay per pay period is " LINE 1 COLUMN 1
MOVE PAMOUNT-IN TO PAMOUNT-OUT.
DISPLAY PAMOUNT-OUT LINE 1 COLUMN 33.
DISPLAY "Number of pay periods per year is " LINE 3 COLUMN 1.
DISPLAY PPERIOD-IN LINE 3 COLUMN 35.
DISPLAY "The annual pay is " LINE 5 COLUMN 1.
COMPUTE ANNUALPAY =PAMOUNT-IN * PPERIOD-IN.
MOVE ANNUALPAY TO ANNUALPAY-OUT.
DISPLAY ANNUALPAY-OUT LINE 5 COLUMN 21.
DISPLAY "PRESS ANY KEY TO CONTINUE. . ." LINE 7 COLUMN 1.
ACCEPT USER-KEY LINE 7 COLUMN 33.
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. ASSIGNMENT3CBL.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 USER-KEY PIC X VALUE SPACES.
01 N1 PIC 999 VALUE 0.
01 N2 PIC 999 VALUE 0.
01 N3 PIC 999 VALUE 0.
01 AVG PIC 999 VALUE 0.
01 TOTAL PIC 9999 VALUE 0.
01 TOTAL-OUT PIC ZZZ9.
PROCEDURE DIVISION.
DISPLAY "*** THE AVERAGE OF THREE NUMBERS ***" LINE 1 COLUMN 1.
DISPLAY "ENTER NUMBER 1: " LINE 3 COLUMN 1.
ACCEPT N1 LINE 3 COLUMN 17.
DISPLAY "ENTER NUMBER 2: " LINE 4 COLUMN 1.
ACCEPT N2 LINE 4 COLUMN 17.
DISPLAY "ENTER NUMBER 3: " LINE 5 COLUMN 1.
ACCEPT N3 LINE 5 COLUMN 17.
DISPLAY "NUMBER 1: " LINE 7 COLUMN 1.
DISPLAY N1 LINE 7 COLUMN 17.
DISPLAY "NUMBER 2: " LINE 8 COLUMN 1.
DISPLAY N2 LINE 8 COLUMN 17.
DISPLAY "NUMBER 3: " LINE 9 COLUMN 1.
DISPLAY N3 LINE 9 COLUMN 17.
COMPUTE TOTAL= N1+N2+N3.
COMPUTE AVG= TOTAL / 3.
MOVE TOTAL TO TOTAL-OUT.
DISPLAY "AVERAGE: " LINE 11 COLUMN 1.
DISPLAY AVG LINE 11 COLUMN 13.
DISPLAY "TOTAL: " LINE 12 COLUMN 1.
DISPLAY TOTAL-OUT LINE 12 COLUMN 12.
DISPLAY "TRY AGAIN?" LINE 14 COLUMN 1.
ACCEPT USER-KEY LINE 14 COLUMN 11.
IDENTIFICATION DIVISION.
PROGRAM-ID. ASSIGNMENT4.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 USER-KEY PIC X VALUE SPACE.
01 PURCHASE PIC 99 VALUE 52.
01 COUNTYSALESTAX PIC 9V99 VALUE 0.02.
01 STATESALESTAX PIC 9V99 VALUE 0.04.
01 TOTALSALESTAX PIC 9V99 VALUE 0.
01 PURCHASE-OUT PIC $99 VALUE 0.
01 COUNTYSALESTAX-OUT PIC $9.99.
01 STATESALESTAX-OUT PIC $9.99.
01 TOTALSALESTAX-OUT PIC $9.99.
PROCEDURE DIVISION.
DISPLAY "On a purchase of $52:" LINE 1 COLUMN 1.
DISPLAY "The county sales tax =" LINE 3 COLUMN 1.
COMPUTE COUNTYSALESTAX = PURCHASE * 0.02.
MOVE COUNTYSALESTAX TO COUNTYSALESTAX-OUT.
DISPLAY COUNTYSALESTAX-OUT LINE 3 COLUMN 26.
DISPLAY "The sate sales tax =" LINE 5 COLUMN 1.
COMPUTE STATESALESTAX= PURCHASE * 0.04.
MOVE STATESALESTAX TO STATESALESTAX-OUT.
DISPLAY STATESALESTAX-OUT LINE 5 COLUMN 26.
DISPLAY "The total sales tax =" LINE 7 COLUMN 1.
COMPUTE TOTALSALESTAX= STATESALESTAX + COUNTYSALESTAX.
MOVE TOTALSALESTAX TO TOTALSALESTAX-OUT.
DISPLAY TOTALSALESTAX-OUT LINE 7 COLUMN 26.
DISPLAY "Press any key to continue..." LINE 9 COLUMN 1.
ACCEPT USER-KEY LINE 9 COLUMN 33.
STOP RUN
IDENTIFICATION DIVISION.
PROGRAM-ID. ASSIGNMENT5.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 USER-KEY PIC X.
01 MEALPRICE PIC 99V99 VALUE 44.50.
01 TAX PIC 9V99 VALUE 0.
01 TIP PIC 9V99 VALUE 0.
01 TOTALCHARGE PIC 99V99 VALUE 0.
01 MEALPRICE-OUT PIC $$99.99.
01 mTAX-OUT PIC $$9.99.
01 mTIP-OUT PIC $$9.99.
01 mTOTALCHARGE-OUT PIC $$99.99.
PROCEDURE DIVISION.
COMPUTE TAX= MEALPRICE * 0.0675.
COMPUTE TIP= (MEALPRICE + TAX)* 0.15.
COMPUTE TOTALCHARGE = MEALPRICE+TAX+TIP.
DISPLAY"SUMMARY OF CHARGES:" LINE 1 COLUMN 1.
DISPLAY"-------------------" LINE 2 COLUMN 1.
DISPLAY "MEAL:" LINE 4 COLUMN 1.
MOVE MEALPRICE TO MEALPRICE-OUT.
DISPLAY MEALPRICE-OUT LINE 4 COLUMN 15.
DISPLAY "TAX:" LINE 5 COLUMN 1.
MOVE TAX TO mTAX-OUT.
DISPLAY mTAX-OUT LINE 5 COLUMN 16.
DISPLAY "TIP:" LINE 6 COLUMN 1.
MOVE TIP TO mTIP-OUT.
DISPLAY mTIP-OUT LINE 6 COLUMN 16.
DISPLAY "TOTAL CHARGE:" LINE 7 COLUMN 1.
MOVE TOTALCHARGE TO mTOTALCHARGE-OUT.
DISPLAY mTOTALCHARGE-OUT LINE 7 COLUMN 15.
DISPLAY "PRESS 'X' TO EXIT" LINE 9 COLUMN 1.
ACCEPT USER-KEY LINE 9 COLUMN 30
STOP RUN
IDENTIFICATION DIVISION.
PROGRAM-ID. ASSIGNMENT6.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 USER-KEY PIC X.
01 ITEM1 PIC 99V99 VALUE 12.95.
01 ITEM1-OUT PIC $99.99.
01 ITEM2 PIC 99V99 VALUE 24.95.
01 ITEM2-OUT PIC $99.99.
01 ITEM3 PIC 9V99 VALUE 6.95.
01 ITEM3-OUT PIC $$9.99.
01 ITEM4 PIC 99V99 VALUE 14.95.
01 ITEM4-OUT PIC $99.99.
01 ITEM5 PIC 9V99 VALUE 3.95.
01 ITEM5-OUT PIC $$9.99.
01 SUBTOTAL PIC 99V99 VALUE 0.
01 SALESTAX PIC 9V99 VALUE 0.
01 TOTAL PIC 99V99 VALUE 0.
01 SUBTOTAL-OUT PIC $99.99.
01 SALESTAX-OUT PIC $$9.99.
01 TOTAL-OUT PIC $99.99.
PROCEDURE DIVISION.
DISPLAY "TOTAL PURCHASE" LINE 2 COLUMN 9.
DISPLAY "ITEM #1:" LINE 4 COLUMN 1.
MOVE ITEM1 TO ITEM1-OUT.
DISPLAY ITEM1-OUT LINE 4 COLUMN 26.
DISPLAY "ITEM #2:" LINE 5 COLUMN 1.
MOVE ITEM2 TO ITEM2-OUT.
DISPLAY ITEM2-OUT LINE 5 COLUMN 26.
DISPLAY "ITEM #3:" LINE 6 COLUMN 1.
MOVE ITEM3 TO ITEM3-OUT.
DISPLAY ITEM3-OUT LINE 6 COLUMN 26.
DISPLAY "ITEM #4:" LINE 7 COLUMN 1.
MOVE ITEM4 TO ITEM4-OUT.
DISPLAY ITEM4-OUT LINE 7 COLUMN 26.
DISPLAY "ITEM #5:" LINE 8 COLUMN 1.
MOVE ITEM5 TO ITEM5-OUT.
DISPLAY ITEM5-OUT LINE 8 COLUMN 26.
COMPUTE SUBTOTAL= ITEM1+ITEM2+ITEM3+ITEM4+ITEM5.
MOVE SUBTOTAL TO SUBTOTAL-OUT.
DISPLAY "SUBTOTAL:" LINE 10 COLUMN 1.
DISPLAY SUBTOTAL-OUT LINE 10 COLUMN 26.
DISPLAY "SALES TAX:" LINE 11 COLUMN 1.
COMPUTE SALESTAX= SUBTOTAL * 0.06.
MOVE SALESTAX TO SALESTAX-OUT
DISPLAY SALESTAX-OUT LINE 11 COLUMN 26.
DISPLAY "TOTAL:" LINE 12 COLUMN 1.
COMPUTE TOTAL= SALESTAX + SUBTOTAL
MOVE TOTAL TO TOTAL-OUT
DISPLAY TOTAL-OUT LINE 12 COLUMN 26
.
DISPLAY"PRESS 'X' TO EXIT" LINE 14 COLUMN 1.
ACCEPT USER-KEY LINE 14 COLUMN 26.
STOP RUN