Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
IDENTIFICATION DIVISION.
PROGRAM-ID. HW01AP.
AUTHOR AlexanderPitterle
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-COURSE-SCORE PICTURE S9(03) VALUE 0.
01 WS-PASSING-SCORE PICTURE 9(02) VALUE 70.
01 WS-POINTS-ABOVE-PASS PICTURE 9(02) VALUE 0.
01 WS-POINTS-BELOW-PASS PICTURE 9(02) VALUE 0.
01 WS-MONEY-MULTIPLIER PICTURE 9(01) VALUE 3.
01 WS-MONEY-EARNED PICTURE $9(02).9(2) VALUE 0.
PROCEDURE DIVISION.
DISPLAY 'Enter your score to see if you passed the class: '.
DISPLAY ' '.
ACCEPT WS-COURSE-SCORE.
IF WS-COURSE-SCORE > 100 OR WS-COURSE-SCORE < 0
DISPLAY 'Invalid Input. Your given score should be between 0 and 100'
ELSE IF WS-COURSE-SCORE >= WS-PASSING-SCORE
DISPLAY 'You passed the course with a score of: ' WS-COURSE-SCORE
COMPUTE WS-POINTS-ABOVE-PASS = WS-COURSE-SCORE - WS-PASSING-SCORE
DISPLAY 'You were ' WS-POINTS-ABOVE-PASS ' points above the passing grade!'
MULTIPLY WS-MONEY-MULTIPLIER BY WS-POINTS-ABOVE-PASS GIVING WS-MONEY-EARNED
DISPLAY 'You earned ' WS-MONEY-EARNED ' as a bonus!'
ELSE
DISPLAY 'Your score of ' WS-COURSE-SCORE ' did not pass the course'
DISPLAY 'A course score of ' WS-PASSING-SCORE ' is required to pass.'
COMPUTE WS-POINTS-BELOW-PASS = WS-PASSING-SCORE - WS-COURSE-SCORE
DISPLAY 'You were ' WS-POINTS-BELOW-PASS ' points away from passing this course.'
STOP RUN.
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more