try {
MealExpenses expenses = expenseReportDAO.getMeals(employee.getID());
m_total += expenses.getTotal();
} catch(MealExpensesNotFound e) {
m_total += getMealPerDiem();
}
should instead be
MealExpenses expenses = expenseReportDAO.getMeals(employee.getID());
m_total += expenses.getTotal();
That is, the no meal expenses found thing should be handled internally. One solution
is to have getMeals() to return an object, which, depending on if meal expenses
exist or not, will be one of two types both of which inherit from a parent class
defining their interface. This is called the Special Case Pattern.
bj 2019-09-22