Ei guys help with my Code ... im stuck with it .. im begginer and i need some extra knowledge
This code is sample only...
import java.io.*; public class While1 { public static BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); public static void main(String args [])throws Exception { int customer = 0; int num = 0; String A = ""; int total = 0; do{ System.out.print("enter a number: "); num=Integer.parseInt(input.readLine()); System.out.print("Enter again:"); A = input.readLine(); total = num; }while(A.equalsIgnoreCase("y")); customer++; if(A.equalsIgnoreCase("n")) { System.out.print("customer " + customer + ":"); if(A.equalsIgnoreCase("n")) { System.out.print(num); System.out.print("\n ========\n"+"\n"+"\t"+total); total+=num ; } System.out.println(); } } }
in this code .. i want to know how to add every customer .. Like if i enter 'Y' 5 times the customer will be print 5 times like
customer 1: , customer 2: etc , and then the total of every customer will be print and after that i will get the Sum of all the
customer ..
Sorry about that guys.. but please help