The Decision Table

This section demonstrates the generation of Java using the following decision table:

invoice total 01

Given the following data for an order:

  • the value of the order in EUR

  • the discount with a value equal to or greater than 0 in percent or as a fixed amount in EUR

  • the postage amount in EUR, in case postage is to be charged

The following data for the invoice is to be determined:

  • the discount value to be taken into account

  • the postage to be charged

  • the final invoice amount

Example

To illustrate, here is an example of rule R02 in text form:

Given the shipping costs are EUR 6.12
When  the order value is EUR 70.00
*     a discount code with a value of 30 % has been entered
*     the order process has been completed
Then  a discount of EUR 21.00 is applied
*     postage of EUR 6.12 is charged
*     the total amount is EUR 55.12