do-while cycle sum help...
Hi i am doing this parking lot program.
i have declared like this:
do{
double payment=rf.readDouble();
System.out.println("Amount to pay: "+payment);
double sum=0;
sum=sum+payment;
System.out.println(sum);
}while(ci !='n');
all the code is inside a do-while , as you can see.
What i want is that everytime a do--while cycle goes, the variable "sum" holds the payment of the first cycle, plus the payment of the second cycle, and so on., so i can have a total.
At the moment everytime a cycle goes, the "sum" value its the same as "payment".
what should i do to make this work?
thanks for any response...

