views:

23

answers:

1

This is a result of ActionListener. Depending on what he chooses in the Combo Box it returns a price. I just want it as a simple $39.99. Nothing more.

I have the

packageIndex = packageChoice.getSelectedIndex();

All the prices are in an array:

String[] prices = {"49.99, 39.99, 34.99, 99.99"}

Now I need to know how to pull the price out and display it and be able to work with the data later on. But I don't know how to pull a piece of the array out and set it to another variable.

A: 

If you declare the array like:

String[] prices = {"49.99", "39.99", "34.99", "99.99"}

then you can get individual prices using:

String price = prices[packageIndex];
fgb
I declared price as a double and set the prices array to doubles. I need to work the data later.
Nick Gibson