3.6 Exercises
Answers to selected exercises are available on the book Web site; see Appendix B for details.
1. The business rule from Section 3.1 on p. 13 is as follows: "A 5 percent discount is provided whenever the total purchase is greater than $1,000." Using this business rule, color in Figure 3.6, based on the traffic light colors in Section 3.2 on p. 14. Do so as it would be reported by Fit, according to whether the tests pass. You don't need to bother to insert actual values where a test value is wrong.
Table 3.6. Color in the Table
CalculateDiscount |
|
amount |
discount() |
1.00 |
0.00 |
10.00 |
0.50 |
1400.00 |
75.00 |
20000.00 |
200.00 |
2. The business rule from Section 3.3 on p. 16 is as follows: "Credit is allowed, up to an amount of $1,000, for a customer who has been trading with us for more than 12 months, has paid reliably over that period, and has a balance owing of less than $6,000." Color in Figure 3.7, using this business rule, as in the previous exercise.
Table 3.7. Color in the Table
CalculateCredit |
||||
months |
reliable |
balance |
allow credit() |
credit limit() |
13 |
true |
5900.00 |
true |
1000.00 |
12 |
true |
0.00 |
false |
1000.00 |
24 |
false |
1000.00 |
false |
0.00 |
18 |
false |
6000.00 |
true |
1000.00 |
3. Create a ColumnFixture table for the following.
Percentages of dollar amounts are rounded to the nearest cent.
4. Create a ColumnFixture table for this business rule.
We charge for time, based on the charge rate of the consultant, in units of whole hours and with a minimum charge of $5,000.
5. Create a ColumnFixture table for a simple business rule that is relevant to you and that involves simple calculations.