In an airline reservation system, the cost of an airline ticket is required. Which data type should be used to store this value?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Prepare for the Arizona State University CSE110 Exam 1. Study with flashcards and multiple choice questions, each question has hints and explanations. Get ready for success!

The most appropriate data type for storing the cost of an airline ticket is a double. This is because a double can represent decimal numbers with precision, which is essential for financial values like ticket prices that often include cents. For example, a ticket price could be $199.99 or $250.50, both of which require the ability to store fractions of a whole number.

Using a double ensures that calculations involving ticket prices, like total costs or discounts, can be performed accurately without losing any decimal value. In contrast, other data types like int, byte, and short are designed for whole numbers and would not be suitable for representing the ticket prices that require decimal precision. Int can hold larger whole numbers, but not decimal points, while byte and short have even more limited ranges and are not intended for monetary values.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy