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 3 of 3

Thread: I need some help

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I need some help

    Hi I i'd like to make a code in java without arrays with the next purposes:
    ->read some caracteres separates by (,) like this #,$,%,&,@,_,
    ->next replace the caracteres who are repeated more than 3 times;
    -> next show to user;

    i have a code but its not right

    public static String IntroduzirLinha(){
    			Scanner leitor = new Scanner(System.in);
    		System.out.println("De uma frase terminada com  ");
     
    		String token = leitor.next();
    		String result = "blablablabla";
    		int aCount = 0;
    		for (int i=0; i<result.length(); i++) {  
    		char c = result.charAt(i);  
     
     
     
    		switch(result)
    		{
    			case 'a':
    				aCount = aCount +1;
    				break;
    			case 'b':
    				aCount = aCount+1;
    				break;
    			case 'l':
    				aCount = aCount +1;
    			default:
    				System.out.println("Erros in id char");
    			}
    		}
    		String newString = result.replace('e', 't');
    				token=leitor.next();
    				System.out.println(newString);	
    				return result;
    	}

    I'd like some help please , ty in advance

  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: I need some help

    Hi I i'd like to make a code in java without arrays with the next purposes:
    That sounds fun. Good luck with it.

    i have a code but its not right
    Bummer.

    I'd like some help please , ty in advance
    Not a problem, This is what we do here. What seems to be the problem?

    When you have a question, try to explain it as if you were talking to someone who has no clue what you are doing. Because we don't...
    What is not right?
    What does the code do that it shouldn't?
    What should the code do that it does not?

    Sure we could copy paste the code, give it a trial run, troubleshoot the output, try to decide which parts are right and which are not, based on our choices adjust the code, etc..
    Or you could just tell us...

  3. #3
    Junior Member
    Join Date
    Nov 2012
    Posts
    15
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: I need some help

    Can you please let us know which part is not working so we can focus on the same.