USING COBOL An independent pizza owner is trying to figure out what to price eac
ID: 3679657 • Letter: U
Question
USING COBOL
An independent pizza owner is trying to figure out what to price each of his menu items. Please use the data file provided (pizza.dat) which includes the menu item and cost of production. You will generate a report that lists the product, manufacturing cost and retail price. The retail price should include a profit margin of 5%. [Manufacturing cost * 1.05 = retail cost] The layouts are described below as follows: Pizza.dat Layout 1-20 Product Item 21-24 Product Manufacturing Price (99v99)
pizza.dat
Report Layout
0500 0925 1000 0915 Pepperoni Ultimate Eight Meat Lovers Chicken Alfredo Ham and Pineapple 0755 Sausage Veggie Delight BBQ Chicken Gluten Free 1 top 1200 Chicken Artichoke 1125 0575 0800 0880Explanation / Answer
IDENTIFICATION DIVISION. PROGRAM-ID. REP01. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT INPUT-FILE ASSIGN TO "RATE.DAT". SELECT FORM1-REPORT ASSIGN TO "FORM1.DAT". DATA DIVISION. FILE SECTION. FD INPUT-FILE. 01 INPUT-RECORD. 02 I-NAME. 03 I-PIZZA PIC X(20). 03 I-RATE PIC 9999. FD FORM1-REPORT. 01 FORM1-PRINT-LINE PIC X(80). FD FORM2-REPORT. 01 FORM2-PRINT-LINE PIC X(80). WORKING-STORAGE SECTION. 01 END-OF-FILE PIC X VALUE SPACE. 01 MAX-LINES-ON-FORM2 PIC 99 VALUE 55. 01 FORM2-LINE-COUNTER PIC 99 VALUE 00. 01 PAGE-NO PIC 99999 VALUE 0. 01 FORM1-LINE-3. 02 FORM1-PIZZA X (20) 02 FORM1-RATE PIC 9999. 01 FORM1-HEADER-1. 02 PIC X(15) VALUE SPACES. 02 PIC X(30) VALUE " PIZZA SALES FOR CURRENT MONTH ". 02 PIC X(10) VALUE SPACES. 02 PIC XXXXX VALUE "Page ". 02 F2H-PAGE PIC ZZZZZ. PROCEDURE DIVISION. A000-BEGIN. OPEN INPUT INPUT-FILE OUTPUT FORM1-REPORT PERFORM A900-PRINT-HEADERS-ROUTINE. PERFORM A100-PRINT-REPORTS UNTIL END-OF-FILE = "Y". CLOSE INPUT-FILE FORM1-REPORT DISPLAY "END OF JOB". STOP RUN. A100-PRINT-REPORTS. READ INPUT-FILE AT END MOVE "Y" TO END-OF-FILE. IF END-OF-FILE NOT = "Y" PERFORM A200-PRINT-REPORTS. A200-PRINT-REPORTS. WRITE FORM1-PRINT-LINE FROM FORM1-LINE-3 AFTER ADVANCING 3 LINES. MOVE I-PIZZA TO FORM1-NAME. FORM1-RATE = I-RATE * 1.5 WRITE FORM1-PRINT-LINE FROM FORM1-LINE-15. A900-PRINT-HEADERS-ROUTINE. * * This routine generates a form feed, writes two lines, * skips two lines, then resets the line counter to 4 to * indicate used lines on the current logical page. * Line 5 on this page is the next print line. * ADD 1 TO PAGE-NO. MOVE PAGE-NO TO F2H-PAGE. WRITE FORM1-PRINT-LINE FROM FORM1-HEADER-1 AFTER ADVANCING PAGE. MOVE 4 TO FORM1-LINE-COUNTER.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.