*--------------------------------------------
* berechne Rabatt Andreas Spillner/HS-Bremen
* Softwaretechnik Trends Band 44 Heft 4
*--------------------------------------------
Identification Division.
Program-Id. Calculate-Price.
Author. NN.
Data Division.
Working-Storage Section.
77 addon-discount pic 9(8)V9(8).
Linkage Section.
77 baseprice pic 9(8)V9(8).
77 specialprice pic 9(8)V9(8).
77 extraprice pic 9(8)V9(8).
77 extras pic 9(4).
77 discount pic 9(8)V9(8).
77 result pic 9(8)V9(8).
Procedure Division using baseprice, specialprice,
extraprice, extras returning result.
* Beispiel mit Fehler!
if extras>=3 then
move 10 to addondiscount
else if extras >=5 then
move 15 to addondiscount
else
move 0 to addondiscount.
if discount>=addon-discount then
move discount to addon-discount.
compute result =baseprice / 100 * (100-discount)
+ specialprice+extraprice/100
*(100-addon-discount)
* result wird zurückgegeben
End-Program Calculate-Price.
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet am 2026-11-04)
¤
*© Formatika GbR, Deutschland