In my program marks this error and I do not know where the problem is.
What I try to do is generate 45 numbers of an integer and a decimal, save them in 3 arrays of 15 elements each and generate another arrangement of only 3 elements where the sum of each of the arrangements is saved and the final show the 4 arrangements in 4 consecutive columns.
This is my program:
StdIn in = new StdIn ();
float[] PC = new float [15];
float[] SC = new float [30];
float[] TC = new float [46];
int A, B, C;
float S;
for (A = 1 ; A < 15 ; A++)
{
System.out.println ("Primer Columna");
System.out.print (A + "\tNumero: ");
PC [A] = in.readFloat ();
}
for (B = 15 ; B < 30 ; B++)
{
System.out.println ("Segunda Columna");
System.out.print (B + "\tNumero:\t");
SC [B] = in.readFloat ();
}
for (C = 30 ; C < 46 ; C++)
{
System.out.println ("Tercer Columna");
System.out.print (C + "\tNumero:\t");
TC [C] = in.readFloat ();
}
System.out.println ("Primer Columna" + PC [A]);
System.out.println ("Segunda Columna" + SC [B]);
System.out.println ("Tercer COlumna" + TC [C]);
S = PC [A] + SC [B] + TC [C];
System.out.println ("Sumatoria de las 3 columnas" + S);
}
}
And the line that marks "bad" after that error is this:
System.out.println ("Primer Columna" + PC [A]);