Hello


I've been banging my head against the wall with this.

Using the input from a GUI, I'm wanting to input rate and time values into a 2D array.

The number of rows is arbitrary (it does take into account a specified constraint -- the total number of minutes), but the columns hold rate and time values.

After entering in these rate and time values, a report is run which should total the rows by multiplying array[index][0] (rate) by array[index][1] time.

Averages are derived, and these figures are passed as a string to a textArea.

Here is the output in the textArea:

the first set of numbers are the created in the GUI with each action. "Report of your wages to date:" figures are from the reporting method.

Minutes: 60.0 Hourly Rate: 20.0 Earnings: 20.0
Minutes: 60.0 Hourly Rate: 30.0 Earnings: 30.0
Minutes: 60.0 Hourly Rate: 10.0 Earnings: 10.0


*****
Report of your wages to date:
Total minutes spent tutoring: 60.0
Total Earnings: 10.0
Average per hour rate: 0.16666666666666669


/



public class TutorLogic1 {

int rows = 12;
int columns = 2;
double[][] rateTime = new double[rows][columns];

public void getInputRate(double ratevalue1) {

int index2 = 0;
if (index2 <= rateTime.length - 1)
{
rateTime[index2][0] = ratevalue1;
index2++;
}

}

public void getInputTime(double timevalue1) {

int index1 = 0;
if (index1 <= rateTime.length - 1)
{
rateTime[index1][1] = timevalue1;
index1++;
}

}

//If total time is > 240, throw an exception
public double getTimeTotal() {

double totalTime = 0;
for (int index3 = 0; index3 < rateTime.length; index3++)
{
totalTime = totalTime + rateTime[index3][1];
}
return totalTime;
}

public String getReport() {



double timeTotal2 = 0;
double avgRate = 0;
double avgTime = 0;
double avgCalc = 0;
double rateSum = 0;

//the time value is divided by 60 to derive an hourly rate

for (int index4 = 0; index4 < rateTime.length; index4++)
{
rateSum = rateSum + rateTime[index4][0] * (rateTime[index4][1] / 60);
timeTotal2 = timeTotal2 + rateTime[index4][1];
}

avgRate = rateSum / rateTime.length;
avgTime = timeTotal2 / rateTime.length;
avgCalc = avgRate / avgTime;


String reportOutput = "\n" + "\n" + " *****" + "\n" +
"Report of your wages to date:\n" +
"Total minutes spent tutoring: " + timeTotal2 + "\n" +
"Total Earnings: " + rateSum + "\n" +
"Average per hour rate: " + avgCalc + "\n";


return reportOutput;


}


}


Any help would be greatly appreciated.

Thank you