Household Income

  1. Edit the "Household Income" rule so that it refers to the "householdIncome" rule in the "SampleBenefit" class.
  2. On the "Household Income" rule diagram, edit the "All people in the household who are countable from an income perspective" rule to refer to a new rule in the "SampleBenefit" class called "countableMembers", which is a list of Person objects.
  3. Also on the "Household Income" rule diagram, edit the "person total income" rule to refer to a new rule in the Person class called "totalIncome" of type Number.
  4. Edit the "Countable Household Members" rule so that it refers to the "countableMembers" rule in the SampleBenefit class.
  5. On the "Countable Household Members" rule diagram, edit the "all the people on the household" rule to refer to the "household" rule in the SampleBenefit class.
  6. On the same rule diagram, edit the "Person is countable" rule to refer to a new rule in the Person class called "isCountable" of type Boolean.
  7. Edit the "Countable Person" rule so that it refers to the "isCountable" rule in the Person class.
  8. On the "Countable Person" rule diagram, add the appropriate elements to the comparison so that it becomes age >= 18.
  9. Create a new rule class called "Income".
  10. Edit the "Person Income" rule so that it refers to the "totalIncome" rule in the Person class.
  11. On the Person Income rule diagram, edit the "all the incomes for this person" rule to refer to a new rule in the Person class called "incomes" which is a list of Income objects.
  12. Edit the "countable amount" rule on the same diagram to refer to a new rule in the Income class called "countableAmount" of type Number.
  13. Edit the "Countable Income" rule so that it refers to the "countableAmount" rule in the Income class. You should see a dialog which tells you that another new rule will need to be created in the Income class called "type" click Ok on this dialog.
  14. On the "Countable Income" rule diagram, click on the square icon in the top right-hand corner of the diagram to present the technical view of the decision table. For each row in the decision table, you should now see an extra area underneath the business descriptions containing the technical details.
  15. Edit the technical details for the left-hand column so that they all match their descriptions (i.e. Wages, Tips, Commission, Rental Income).
  16. Drag a Rule from the Business (default) palette over the icon to the left of the "Full Amount" description for the wages row. You should see a golden circle appear,allowing you to drop the rule. Edit the Reference to refer to a new rule in the Income class called "amount" of type Number.
  17. Drag an Arithmetic element onto the result for the Tips row. Click on the "operator" dropdown in the middle of the element and change it to "/" operator. Drag a Rule from the Business (default) palette to the left of the operator and refer it to the "amount" rule. Now drag a Number from the Data Type palette onto the empty element on the right of the operator and set its value to "2".
  18. Open the context menu on the division element and choose the "copy" option from the menu which pops up. Move the mouse over the icon for the Commission row until you see the golden circle and click on it to paste the copied element. Change the operator of this element to be "*".
  19. From the Business (default) palette, drag a Choose element onto the result for the "Rental Income" row. In the dialog which pops up, select "Number" as the type.
  20. Drag a Compare element onto the Empty Condition of the when. Add the appropriate elements to the comparison so that it becomes "amount < 500".
  21. Drag a Rule onto the Empty Value element of the when and refer it to the amount rule.
  22. From the Data Types palette, drag a Number element onto the Empty Value element of the otherwise and change its value in the properties panel to be "500".
  23. Edit the value of the result for the otherwise of the decision table to be "0".