How to calculate a total value based on user selection?