Consider the following problem (one which you may be uncomfortably familiar with!) -

When students get their test results they will need to decide if they want to retake or not. Factors include

The first test is to see if we have met the target grade. Let us say that 50 is the mark we need. This would lead us to the following truth tree -

The false path requires no further processing. We passed so break out the bubbly! The true path, however, does need some extra processing. We need to ensure that we do not burden our brains with too many exams. So we need to test to make sure we are not doing too many retakes. This leads us to the following truth tree -

Creating a truth tree is all about working out what decisions have to be made. We must work out all of the knowledge that we need before we can get to a solution. The truth tree allows us to map out all of the possibilities.

  1. if (mark < 50){
    1. if (exam < 4){
    2. System.out.println("Do the retake");
    3. } else {
    4. System.out.println("Retake later ");
    5. }
  2. } else {
  3. System.out.println("no need to retake ");
  4. }

 

next logical operators >>

 
Basics
Menu
Search