0

I'm making a Riemman sum code for a school project but I keep getting this error at line 37. The line is in the for loop after the statement "String coord2;".

```
String message, message2, numStr, numStr2, numStr3, numStr4, numStr5;
double a, n, xmin, xmax, w, w2, w3, w4, w5, area, totalArea = 0, area2, totalArea2 = 0, area3, totalArea3 = 0, area4, totalArea4 = 0, area5, totalArea5 = 0, coord;
message = "Our group was assigned the method: 'MID-POINT RIEMMAN SUMS'";
JOptionPane.showMessageDialog (null, message);
message2 = "Given the function f(x) = a*x^n...";
JOptionPane.showMessageDialog (null, message2);
numStr = JOptionPane.showInputDialog ("Enter a value for the coefficent of x, 'a': ");
a = Double.parseDouble(numStr);
numStr2 = JOptionPane.showInputDialog ("Enter a value for the power of x, 'n' (enter '1' if you would like no exponent): ");
n = Double.parseDouble(numStr2);
numStr3 = JOptionPane.showInputDialog ("Enter the x-min of the interval which you would like: ");
xmin = Double.parseDouble(numStr3);
numStr4 = JOptionPane.showInputDialog ("Enter the x-max of the interval which you would like: ");
xmax = Double.parseDouble(numStr4);
w = ((xmax - xmin)/5);
for (double count = xmin; count <= 5; count++)
{
area = (w*a)*Math.pow((xmin + (count - 0.5)*w),n);
totalArea += area;
}
String message3 = "The area enclosed between the given interval of the function with subintervals of 5 is: " + totalArea;
JOptionPane.showMessageDialog (null, message3);
coord = JOptionPane.showConfirmDialog (null, "Would you like the x and y values for the subintervals of 5?");
if (coord == JOptionPane.YES_OPTION)
{
String coord2;
for (double x = xmin; x <= xmax; x++)
{
coord2 = "X-value and Y-value: " + /n (xmin + (x - 0.5)*w) + "and" + 4*(xmin + (x - 0.5)*w);
}
}
w2 = ((xmax - xmin)/10);
for (double count2 = xmin; count2 <= 10; count2++)
{
area2 = (w2*a)*Math.pow((xmin + (count2 - 0.5)*w2),n);
totalArea2 += area2;
}
String message4 = "The area enclosed between the given interval of the function with subintervals of 10 is: " + totalArea2;
JOptionPane.showMessageDialog (null, message4);
w3 = (xmax - xmin)/20;
for (double count3 = xmin; count3 <= 20; count3++)
{
area3 = (w3*a)*Math.pow((xmin + (count3 - 0.5)*w3),n);
totalArea3 += area3;
}
String message5 = "The area enclosed between the given interval of the function with subintervals of 20 is: " + totalArea3;
JOptionPane.showMessageDialog (null, message5);
w4 = (xmax - xmin)/10000;
for (double count4 = xmin; count4 <= 10000; count4++)
{
area4 = (w4*a)*Math.pow((xmin + (count4 - 0.5)*w4),n);
totalArea4 += area4;
}
String message6 = "The area enclosed between the given interval of the function with subintervals of 10,000 is: " + totalArea4;
JOptionPane.showMessageDialog (null, message6);
}
}
```