This document defines a CALC class with methods ADD, SUB, and MUL. It creates an instance of the CALC class and calls each method, performing addition, subtraction, and multiplication respectively using data members A and B defined in the class. The results are written to the output.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
37 views2 pages
OOPS
This document defines a CALC class with methods ADD, SUB, and MUL. It creates an instance of the CALC class and calls each method, performing addition, subtraction, and multiplication respectively using data members A and B defined in the class. The results are written to the output.
PUBLIC SECTION. DATA: A TYPE I VALUE 30, B TYPE I VALUE 10, C TYPE I. METHODS: ADD. METHODS: SUB. METHODS: MUL. ENDCLASS. CLASS CALC IMPLEMENTATION. METHOD: ADD. C = A + B. WRITE : / 'ADDITION =', C. ENDMETHOD. METHOD: SUB. C = A - B. WRITE : / 'SUBTRACTION =', C. ENDMETHOD. METHOD: MUL. C = A * B. WRITE : / 'MULTIPLY =', C. ENDMETHOD. ENDCLASS. START-OF-SELECTION.