I'm having a bit of trouble trying to figure out how to get certain values to add up into a total value. This assignment was to create a program that would read values from a provided file. It would then sort them into columns and create an additional column called 'Value'. This would be the Quantity times the Cost values.
The last part would be to add up each value and display a total message. Here is my code.
I have tried a while and a for loop within the current while loop in order to add up the Values. However, that did not work. The total value ended up copying the first item's value when I used the additional while loop. With the For loop, every Value was altered instead of providing a new total.
What am I doing wrong? How should I go about finding the total of these items? I tried both While and For loops at line 50 but removed them since they didn't do anything productive.