Write the If statement in COBOL to determine if the value in the field referenced by TEST-CODE-INPUT is equal to the value in the field GENIUS-CONSTANT. If the values arc equal, add I to GENIUS-COUNT. If the fields are not equal, add 1 to AVERAGE-COUNT. Write the If statement in COBOL to determine if the value in the HOURS-INPUT field is greater than the value in the REGULAR-T1ME-CONSTANT field. If so, add 1 to the OVERTIME-COUNT field. Write the COBOL code in the Working-Storage Section of the Data Division to define the condition name SENIOR-CTTIZEN if the value in the BUYER-INPUT field is equal to the value \"S.\" Write the COBOL If statement to test whether the field BUYER-INPUT contains the value \"S\" using the condition name defined in Exercise #3. If so, multiply GENERAL-ADMISSION by DISCOUNT-PERCENT and add the result to TOTAL-ADMISSIONS-ACCUM. If the buyer is not a senior citizen, add the value in GENERAL-ADMISSION to TOTAL-ADMISSIONS-ACCUM. Write a Perform statement to perform the paragraph COIO-PROCESS-SENIOR-CITIZEN as long as the buyer is a senior citizen as defined In Exercise #3. Define in the Working-Storage Section of the Data Division the Total Counter areas to accumulate the number of students, the number of students who passed a course, and the number of students who failed a course. Write the COBOL If statement and other statements required in the Procedure Division to accumulate the number of students who took a course, the number of students who passed a course, and the number of students who did not pass a course. If the value in GRADE-INPUT is 70 or higher, the student passed the course. Otherwise, the student failed the course. Accumulate the counts In the fields defined in Exercise #6, .
This question has multiple questions. I will answer first 2 questions. Please post separate questions for others.
1)
For this code we will compare the values of the fields TEST-CODE-INPUT and GENIUS-CONSTANT and based on that we will increment/decrement the value of certain variables. we will use a if else construct for our code.
working code:
IDENTIFICATION DIVISION.
PROGRAM-ID. IDEONE.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
IF TEST-CODE-INPUT IS EQUAL TO GENIUS-CONSTANT THEN
ADD 1 TO GENIUS-CONSTANT
ELSE
ADD 1 TO AVERAGE-COUNT
END-IF
STOP RUN.
2
For this program we will just use the if construct of cobol and we will compare the values of HOURS-INPUT field and the REGULAR-TIME-CONSTANT field and depending upon their value we will increment the value.
working code:
IDENTIFICATION DIVISION.
PROGRAM-ID. IDEONE.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
IF HOURS-INPUT IS GREATER THAN REGULAR-TIME-CONSTANT THEN
ADD 1 TO OVERTIME-COUNT
STOP RUN.