*>OBJECT COBOL CLASS PROGRAM $set ooctrl(+n) $set sourceformat "free" *>***************************************************** *> Room Rental System *> W. Price 03/20/96 ROOM03CL.CBL *> *> This class contains the room data and the method *> "get-room-prices". *> Input: Discount switch *> Output: Standard configuration price *> Special configuration price *>***************************************************** Identification Division. Class-id. RoomClass inherits from Base. Environment Division. Object Section. *> Identify the classes and their files Class-Control. RoomClass is class "room03cl" Base is class "base" . *>===================================================== OBJECT. Data Division. Object-Storage Section. 01 room-data. 10 room-number pic 9(03) value 100. 10 std-config-price pic 9(03) value 225. 10 spec-config-price pic 9(03) value 385. 10 room-discount pic v9(02) value .05. 10 room-capacity pic 9(02) value 38. Procedure Division. *>------------------------------------------------- Identification Division. Method-id. "get-room-prices". *>------------------------------------------------- Data Division. Working-Storage Section. 01 price-factor pic 9(01)v9(02). Linkage Section. 01 ls-apply-discount-sw pic x(01). 88 ls-apply-discount value "Y" "y". 01 ls-room-prices. 10 ls-std-config-price pic 9(03). 10 ls-spec-config-price pic 9(03). Procedure Division Using ls-apply-discount-sw Returning ls-room-prices. Move std-config-price to ls-std-config-price Move spec-config-price to ls-spec-config-price Evaluate TRUE When ls-apply-discount Subtract room-discount from 1.0 giving price-factor Multiply price-factor by ls-std-config-price Multiply price-factor by ls-spec-config-price End-Evaluate *> TRUE Exit method . End Method "get-room-prices". *>------------------------------------------------- END OBJECT. END CLASS RoomClass.