181k views
4 votes
Which of the following array declarations would be best suited for storing the retail prices?

a) None of the above
b) Declare real retailPricesize
c) Declare integer retailPricesize
d) All of the above
e) Declare string retailPricesize

1 Answer

3 votes

Final answer:

The best array declaration for storing retail prices is 'Declare real retailPrices', as it allows for decimal precision necessary for representing prices.

Step-by-step explanation:

To store retail prices which often include a decimal point to represent cents, the appropriate data type would be a real or floating-point data type. Among the options provided, b) Declare real retailPrices is the best suited for this purpose. Integer and string data types are not well-suited for representing prices as integers do not allow decimal precision and strings would not allow for mathematical calculations without conversion.

User CarlosE
by
8.7k points