When entering sales data into a database, you record the total price of items sold. If an item is sold for $19.99, which data type would be most appropriate to use for accuracy?
The correct answer is 'Floating-point number' because this data type allows for the representation of non-integer numbers that include a decimal point. In our scenario, $19.99 cannot be accurately represented as an integer since it is not a whole number. Using an integer would result in loss of precision, as it would have to be rounded to either $19 or $20.
The other options are incorrect because 'Integer' does not allow for decimal precision, 'Boolean' is used for true/false values, and 'Character' is typically used for single letters or symbols, not numbers with decimals.
Learn More
AI Generated Content may display inaccurate information, always double-check anything important.