after looking at my code 3 time I realized how stupid I am I use the "=+" operator instead of "+=" that is why it wasn't accumulating correctly.
Type: Posts; User: StrangeFruit
after looking at my code 3 time I realized how stupid I am I use the "=+" operator instead of "+=" that is why it wasn't accumulating correctly.
Ok I reentered this code in the first while loop and realized that the code is skipping the first two lines in the .txt file that I am receiving the data from but I don't understand why it is...
I tried implementing this code in the while loop of the "getWeekly Sales" method and a run time exception was thrown:
System.out.println(strtok.nextToken());
public class SalesAnalysis
{
public static void main(String[] args) throws IOException
{
// To hold a line from the file
String line;
// Accumulator for all weeks...
I have rewritten my "getWeeklySales" class but the output is not correct but I am no longer getting a run time exception.
public static double getWeeklySales(String str)
{
double...
public static double getWeeklySales(String str)
{
double weekTotal = 0.0;
// Create the tokenizer.
StringTokenizer strtok = new StringTokenizer(str, ",");
//...
public static double getWeeklySales(String str)
{
double weekTotal = 0.0;
// Create the tokenizer.
StringTokenizer strtok = new StringTokenizer(str, ",");
//...