This program checks to see if the sum of the weights of the apples in a basket are equal to the expected sum of weights. The weight of the apples is calculated in a summing visitor (SummingVisitor) which traverses from Basket to Apple. If the expected weight is equal to the calculated weight, then it prints SUCCESS else FAILURE. There is a GetWeightVisitor which gets the weight of the apple (an integer) for the SummingVisitor, to get around breaking the law of Demeter. The program tests Demeter/Java by checking whether it generates the code, the way it is supposed to. It tests Demeter/Java by checking/testing that Demeter/Java does the right traversals for the SummingVisitor in the the right way, to get/store the sum of the weights of the apples. In the test case (given below), it succedes which tells us that Demeter/Java does make the traversals in the right manner, to the right classes, which is why it ends up with the right answer. The Demeter/C++ version of the program (c-fruit-basket-em) also has a propogation pattern which prints all the apples in the nested basket. But, this is not tested or called in the main program. I went ahead and did convert that propogation pattern too but commented the printing out when I found out that I wasn't supposed to do it. The test run was done with the sample input given in the Demeter/C++ program's directory. The input file contains: basket ( orange 10 orange 10 apple 5 orange 9 basket ( orange 10 apple 5 )) The output is: Total Weight of Apples = 10 Expected = 10 SUCCESS