public static double getWeeklySales(String str)
{
double weekTotal = 0.0;
// Create the tokenizer.
StringTokenizer strtok = new StringTokenizer(str, ",");
// Accumulate the value of the tokens.
while (strtok.hasMoreTokens())
{
weekTotal =+ Double.parseDouble(str);
}
return weekTotal;
}
}
Exception in thread "main" java.lang.NumberFormatException: For input string: "1245.67,1490.07,1679.87,2371.46,1783.92,1461.99,2 059.77"
at sun.misc.FloatingDecimal.readJavaFormatString(Floa tingDecimal.java:1241)
at java.lang.Double.parseDouble(Double.java:540)
at SalesAnalysis.getWeeklySales(SalesAnalysis.java:10 9)
at SalesAnalysis.main(SalesAnalysis.java:61)