Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: LOOping for my Customer ....

  1. #1
    Banned
    Join Date
    Oct 2011
    Posts
    1
    My Mood
    Cynical
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question LOOping for my Customer ....

    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


  2. #2
    Member
    Join Date
    Oct 2011
    Posts
    36
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Wink Re: LOOping for my Customer ....

    I might do not understand your question, here is my code:

    ...edited by moderator

    hope this will be useful.
    Last edited by copeg; October 9th, 2011 at 12:58 PM.

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: LOOping for my Customer ....

    lick999, please read the forum rules as well as the following: The Problems With Spoonfeeding
    Last edited by copeg; October 9th, 2011 at 01:03 PM.

  4. #4
    Member
    Join Date
    Sep 2011
    Posts
    40
    My Mood
    Inspired
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: LOOping for my Customer ....

    I don't quite get what your trying to do, care to elaborate more?

Similar Threads

  1. Looping through an Array.
    By kl2eativ in forum Loops & Control Statements
    Replies: 4
    Last Post: June 10th, 2011, 07:15 PM
  2. Looping an inputstream
    By Trunk Monkeey in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 25th, 2011, 02:39 PM
  3. Help in looping
    By endframe in forum What's Wrong With My Code?
    Replies: 5
    Last Post: December 28th, 2010, 03:24 PM
  4. New "customer" here
    By LofsLoniunort in forum Member Introductions
    Replies: 2
    Last Post: September 17th, 2010, 05:05 AM
  5. [SOLVED] looping, for,while,do-while.
    By chronoz13 in forum Loops & Control Statements
    Replies: 4
    Last Post: August 6th, 2009, 01:32 PM