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 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 : Describe MCP or Model Checker for C plus

    MCP: Model Checker for C++ (MCP) is an explicit-state software model checker being introduced by the Robust Software Engineering group at NASA Ames Research Center (Thompson and Brat, 2008). MCP was constructed specifically to allow programs written i

  • Q : State the term WSDL State the term WSDL

    State the term WSDL?

  • Q : What is a Sub class Sub class : It is a

    Sub class: It is a class which extends its super class. The sub-class inherits all the members of its super class. All Java classes are the sub-classes of Object class, which is at the root of inheritance hierarchy.

  • Q : Define the term Return value Define the

    Define the term Return value: This is the value of the expression employed in a return statement.

  • Q : What is Java What is Java: It is a

    What is Java: It is a portable high level programming language introduced by Sun Microsystems.

  • Q : Define the term Key value Define the

    Define the term Key value: The object employed to produce an associated hash code for look-up in an associative data structure.

  • Q : Write a program and estimate pi using

    Consider a dartboard of radius 1. Since the area of the board will be  π r2 = π * 1 *1, it's clear the area of the dartboard is exactly π. The area of a square surrounding the board (circumscribing it) would be 2*2 = 4, sin

  • Q : What is an Anonymous array Anonymous

    Anonymous array: It is an array formed without an identifier. The anonymous array is generally formed as an actual argument, for example:// generate an anonymous array of integers.    YearlyRainfall y2k = new YearlyRai

  • Q : ArrayLists I. The Assignment The

    I. The Assignment The Bashemin Parking Garage contains a single lane that can hold up to ten cars.  Arriving cars enter the garage at the rear and are parked in the empty space nearest to the front.  Departing cars exit only from the front.  If a cu

©TutorsGlobe All rights reserved 2022-2023.