1. Learn
  2. /
  3. Courses
  4. /
  5. Cleaning Data in Java

Connected

Exercise

Computing mean, min, max

You would like to analyze sales data for your coffee business. The data contains the date of each transaction, coffee name, payment method, quantity sold, and transaction amount, as shown in the sample below. Compute the mean, minimum, and maximum transaction amounts formatted to two decimal places.

date coffee_name payment_method quantity amount
3/1/24 Latte cash 1 $6.26
3/5/24 Hot Chocolate card 3 $32.51
3/6/24 Americano card 2 $18.70

The necessary packages such as LocalDate, Arrays, and List have been imported for you.

Instructions

100 XP
  • Compute the mean transaction amount using stats.
  • Compute the min and max transaction amounts using stats.