View Single Post
  #7 (permalink)  
Old 08-03-2008, 11:24 PM
matt_well's Avatar
matt_well matt_well is offline
Member
 
Join Date: Jul 2008
Posts: 59
Rep Power: 0
matt_well is on a distinguished road
Default
Originally Posted by Norm View Post
Can you sum up sampleData1 and then sampleData2 and add the results together?
In the first loop:
totalSampD1 += sampleData1;
and in the second loop:
totalSampD2 += sampleData2;

Then
total = totalSampD1 + totalSampD2;


Can you write out description of what the program is to do in simple steps? where each step does one simple thing. From beginning to end of the processing to be done. List each step on a separate line.
For example here are the steps you take when walking:
Shift weight to right foot.
Lift left foot
move left foot forward
put left foot on the ground
shift weight to left foot
lift right foot off the ground
move right foot forward
put right foot on the ground
Go back to step one and repeat
Hi, Norm. LOL. Nevermind. I have done it by modifying i to i+1 and i+2.

Code:
        for(int i = 0; i < maxSize; i++)
        {
            String data1 = getNextValue(process1, i+1);
            String data2 = getNextValue(process2, i+2);

            double sampleData1 = parseValue(data1);
            double sampleData2 = parseValue(data2);

            double total = (sampleData1 + sampleData2);
            pw.printf("%1.4f%n",
                       total);
        }
Reply With Quote