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

Connected

Exercise

Transforming numeric data

As an inventory analyst at a grocery store, you need to calculate the total value of your stock. Your data shows product quantities and unit prices, but you need to combine these to understand inventory worth. Since quantities are stored as integers, you'll need to convert them to doubles before multiplying with prices. Calculate each product's total value, creating a new column to track inventory investment.

tablesaw packages have been imported for you.

Instructions

100 XP
  • Print the data type of each column.
  • Convert the integer column Stock_Quantity to a double column.
  • Multiply quantity by unitPrice.