Calculus of variations on time scales: applications to economic models