You are confused about what a multidimensional array is.
A bidimensional array uses two integer indices to store a single value of a specific type.
In your case, you need to create a class holding the quantity and cost; then you can put some instances of this class into a list (more flexible) or into a single-dimension array (less flexible since you have to know how many elements the array will contain upon its creation).
And you should always use
BidgDecimal
type to store and do comptations on values which represent money (
float
and
double
type are not recommended for that, since their floating-point nature can lead to rounding errors).
public class GameLine
{
private int Quantity;
private BigDecimal Cost;
}
Then, you can create a list of
GameLine
objects, and upon iteration of your text file, for each line create a new
GameLine
object and add it to the list. At the end of the procedure, you can turn your list into an array, if needed, but that shouldn't be necessary.