code: private void updateTaskCosts(Task parentTask)
     {
        double baselineCost = 0;
        double actualCost = 0;
        double remainingCost = 0;
        double cost = 0;
  
        //process children first before adding their costs
        for (Task child : parentTask.getChildTasks())
        {
           updateTaskCosts(child);
           baselineCost += NumberHelper.getDouble(child.getBaselineCost());
           actualCost += NumberHelper.getDouble(child.getActualCost());
           remainingCost += NumberHelper.getDouble(child.getRemainingCost());
           cost += NumberHelper.getDouble(child.getCost());
        }
  
        List<ResourceAssignment> resourceAssignments = parentTask.getResourceAssignments();
        for (ResourceAssignment assignment : resourceAssignments)
        {
           baselineCost += NumberHelper.getDouble(assignment.getBaselineCost());
           actualCost += NumberHelper.getDouble(assignment.getActualCost());
           remainingCost += NumberHelper.getDouble(assignment.getRemainingCost());
           cost += NumberHelper.getDouble(assignment.getCost());
        }
  
        parentTask.setBaselineCost(NumberHelper.getDouble(baselineCost));
        parentTask.setActualCost(NumberHelper.getDouble(actualCost));
        parentTask.setRemainingCost(NumberHelper.getDouble(remainingCost));
        parentTask.setCost(NumberHelper.getDouble(cost));
     }
docs: See the notes above.
  
  @param parentTask parent task