Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

COBOL Page 300, Problem #8 The Pass-Em State College has a student file with the

ID: 3674857 • Letter: C

Question

COBOL

Page 300, Problem #8

The Pass-Em State College has a student file with the following data:

SSNO; STUDENT NAME; CLASS; SCHOOL; GPA 9V99; CREDITS EARNED

1-9; 10-30; 31; 32; 33-35; 36-38

Column 31 is:

1 = Freshman

2 = Sophomore

3 = Junior

4 = Senior

Column 32 is:

1 = Business

2 = Liberal Arts

3 = Engineering

Print the average GPA for all students at the college. List the appropriate Class and School name for each student & label the data.

NOTE: Headers are required to label each record. Each record must be printed to an output file with the proper formatting for SSN, The name of the Class and the name of the School and GPA.

EXTRA CREDIT: 10% if you give an additional footer with the count of all "Freshman = xx, Sophomore = xx, Junior = xx, & Senior = xx"

Explanation / Answer

I can help u with this:


ENVIRONMENT DIVISION.
FILE-CONTROL.
SELECT STUDENT-IN ASSIGN TO "CH1407.DAT"
ORGANIZATION IS LINE SEQUENTIAL.
SELECT SORT-FILE ASSIGN TO "CH1407-SORT.TMP".
SELECT STUDENT-OUT ASSIGN TO "CH1407-OUTPUT.DAT"

FD STUDENT-IN.
01 STUDENT-RECORD.
88 ENDOFFILE VALUE HIGH-VALUES.
05 STUDENT-NO PIC X(5).
05 STUDENT-NAME PIC X(45).
05 STUDENT-CREDITS PIC 9(3).
88 FRESHMAN VALUE 000 THROUGH 029.
88 SOPHOMORE VALUE 030 THROUGH 059.
88 JUNIOR VALUE 060 THROUGH 089.
88 SENIOR VALUE 090 THROUGH 999.
SD SORT-FILE.
01 SORT-DATA.
05 SORT-NO PIC X(5).
05 SORT-NAME PIC X(45).
05 SORT-CREDITS PIC 9(3).
05 SORT-CLASS-NO PIC 9(1).
* OUTPUT FILE NEXT, FOR EASE OF LAYOUT
FD STUDENT-OUT.
01 STUDENT-OUTPUT.
05 OUT-NO PIC X(5).
05 OUT-NAME PIC X(45).
05 OUT-CLASS-NO PIC 9(4).

PROCEDURE DIVISION.
001-MAIN.
SORT SORT-FILE
ON ASCENDING KEY SORT-CLASS-NO
ON ASCENDING KEY SORT-NAME
INPUT PROCEDURE 002-READ-FILE
GIVING STUDENT-OUT
STOP RUN.
002-READ-FILE.
OPEN INPUT STUDENT-IN
PERFORM UNTIL ENDOFFILE
READ STUDENT-IN
AT END SET ENDOFFILE TO TRUE
NOT AT END PERFORM 003-CLASS-NO
END-READ
END-PERFORM
CLOSE STUDENT-IN.
003-CLASS-NO.
MOVE STUDENT-RECORD TO SORT-DATA
EVALUATE TRUE
WHEN FRESHMAN MOVE 1 TO SORT-CLASS-NO
WHEN SOPHOMORE MOVE 2 TO SORT-CLASS-NO
WHEN JUNIOR MOVE 3 TO SORT-CLASS-NO
WHEN SENIOR MOVE 4 TO SORT-CLASS-NO
END-EVALUATE
RELEASE SORT-DATA.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote