Problem on COBOL if sentence

Write a COBOL IF sentence to use the values of numeric variables EXAM and COURSEWORK, both assumed to be with format PIC 999 and in the range 0 to 100 and to move the value:
“FAIL”,
“RC” ( resit coursework),
“RE” (resit examination”),
“RB” (resit both examination and coursework) or
“PASS”
 to the variable RESULT with format PIC XXXX, according to this flowchart:

1201_cobol.jpg

E

Expert

Verified

Using EVALUATE is easier, but since asked to use IF
Assume Passing mark is 50

01 EXAM PIC 999
01 COURSEWORK PIC 999
01 RESULT PIC X(4)
 
ACCEPT EXAM.
ACCEPT COURSEWORK.

IF EXAM<30 AND COURSEWORK<30
    MOVE ‘FAIL’ TO RESULT
IF EXAM>39 AND (COURSEWORK>29 AND COURSEWORK<40)
    MOVE ‘RC’ TO RESULT
IF (EXAM>29 AND EXAM<40) AND COURSEWORK>49
    MOVE ‘RE’ TO RESULT
IF (EXAM>29 AND EXAM<40) AND(COURSEWORK>29 AND COURSEWORK<40)
    MOVE ‘RB’TO RESULT
IF EXAM>39AND COURSEWORK>39
    MOVE ‘PASS’ TO RESULT
DISPLAY RESULT.

   Related Questions in Programming Languages

  • Q : Program to Calculate Estimate

    Collaboration Policy Collaboration between students on programming assignments is NOT allowed under any circumstances - you may not even discuss your work with other

  • Q : Explain SQA personnel regarding

    Do you think that the role of SQA personnel regarding inspections or testing?

  • Q : Define Peer Peer : It is a term

    Peer: It is a term employed of the Abstract Windowing Toolkit (AWT) to refer to the underlying classes which give the platform-specific implementation of the component classes.

  • Q : Explain Abstraction Abstraction : It is

    Abstraction: It is a simplified symbolization of something which is potentially quite complex. It is frequently not essential to know the precise details of how something works, is symbolized or is implemented, since we can still make use of it in its

  • Q : Situations where AJAX must not be used

    Explain the situations in which the AJAX must not be used.

  • Q : Commands used to create the files

    Specify different commands which are used in order to create the files?

  • Q : Explain Command-line argument

    Command-line argument: The arguments passed to a program whenever it is run. The Java program receives such in the single formal argument to its major method: public static void main(String[] args)

  • Q : What is validating parser What is

    What is validating parser? Answer: A parser makes sure that an XML document is valid additionally to being well formed.

  • Q : Explain Array initializer Array

    Array initializer: This is an initializer for an array. The initializer takes the position of separate creation and initialization steps. For example, the initializer int[] pair = { 4, 2, };

    Q : Define the term Garbage collector

    Garbage collector: It is a daemon thread which recycles objects to which there are no extant references in a program.

©TutorsGlobe All rights reserved 2022-2023.