--%>

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 : What is PIDs What is meant by the PIDs?

    What is meant by the PIDs?

  • Q : What is an Arithmetic expression

    Arithmetic expression: It is an expression comprising numerical values of integer or floating point kinds. For example, operators like +, -, *, / and % get arithmetic expressions as their operands and generate arithmetic values as their outcomes.

  • Q : Advantage of wrapping database calls in

    What is the advantage of wrapping database calls in MTS transactions?

  • Q : What is an Operand Operand : An operand

    Operand: An operand is an argument of the operator. Expressions comprise combinations of operands and operators. The value of an expression is determined by exerting the operation stated by each and every operator to the value of its operands.

  • Q : State the terms preemption and context

    State the terms preemption and context switching.

  • Q : Explain Sign extension Sign extension :

    Sign extension: Whenever an integer value from a type with a specific range is stored in a variable with a larger range, Java employs sign extension to determine the resultant value. The most important bit in the original value is employed to fill the

  • Q : What is Variable Variable : It is the

    Variable: It is the memory block of specific size where value can be stored and modified throughout program execution. Example: int x, float y, float amount, char c;

  • Q : Describe Multiple-boot options

    Multiple-boot options: The hardware configurations of several computers are capable to run various operating system and window manager combinations. A few systems permit a user to select which combination they wish to utilize during a specific session

  • Q : What is Cursor Cursor : This is a

    Cursor: This is a visual representation of the existing position of the mouse on the user's virtual desktop. Cursor shapes are frequently set to symbolize the current state of a program – utilizing an hour glass shape to point out that the user

  • Q : What is an Integer What is an Integer :

    What is an Integer: It is a negative or positive whole number. The primitive types are: short, byte, int and long are utilized to hold integer values in narrower or broader ranges.