Data Type Option Pane
Goal:
Create a new enum and populate a JOptionPane with a selection of choices for use with a switch statement.
Steps:
- Create a new enum called DataType. The entries should be the primitive data types listed here.
- Give the enum a member variable called bits.
- Set each entry's default value to the number of bits it can hold.
- Create a constructor to initialize bits and a getter to access bits.
- Initialize the dataTypes array to have one of each unique value using the .values() method.
- Create a JOptionePane Option Dialog that asks the user to select the data type they want to learn about. Use the dataTypes array for the options parameter and save the result into an int.
- Create a switch statement that switches on the dataTypes enum array at the result of the Option dialog. For each value in the data type enum, create a case with a Message Dialog that tells the user what kinds of values the type can contain and use the getter to display how many bits it is made up of.