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

Thread: Need help with index of coincedence

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need help with index of coincedence

    Output two similar length strings that have the same letters in their letter count.

    Is there a website I can view to learn to do this? I tried searching but counldn't find anything.


  2. #2
    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: Need help with index of coincedence

    Is there a website I can view to learn to do this?
    Why not give it a try yourself? This is a fundamental aspect of programming - problem solving. Break the problem down, how would you do this by hand? Write it out on paper, then translate to code. Make use of the java API, for example the String class.

  3. #3
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Need help with index of coincedence

    Should I change both strings into array, then check the array index in a for statement? The problem is that there are a lot of scripts that I have not seen before and I am sure there is a particular one for this problem.

    import java.util.*;
    public class indexofcoincedence
    {public static void main (String[] args)
    {
    int len1=0; int len2=0;
    Scanner input = new Scanner(System.in);
    System.out.println( "Enter a word");
    String word1 = input.nextLine();
    System.out.println( "Enter a word");
    String word2 = input.nextLine();
    len1=word1.length();
    len2=word2.length();
    while (len1==len2)
    {

    }
    }
    }

  4. #4
    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: Need help with index of coincedence

    Evidently I'm wasting my time here. Anywhere else you posted that you would like to disclose?

    This thread has been cross posted here:

    http://www.java-forums.org/new-java/50550-need-help-index-coincedence.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting


  5. #5
    Junior Member
    Join Date
    Oct 2011
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Need help with index of coincedence

    Sorry, I was just trying to get the quickest reply as possible.

Similar Threads

  1. Array index out of bounds
    By fortune2k in forum Collections and Generics
    Replies: 1
    Last Post: November 30th, 2010, 07:11 AM
  2. String Index out of range
    By petemyster in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 8th, 2010, 03:59 PM
  3. String index out of bounds error 5???
    By stealthmonkey in forum What's Wrong With My Code?
    Replies: 3
    Last Post: September 26th, 2010, 07:11 PM
  4. index of array
    By nasi in forum Java Theory & Questions
    Replies: 1
    Last Post: April 12th, 2010, 02:39 AM
  5. Index Out Of Bounds
    By chronoz13 in forum Collections and Generics
    Replies: 1
    Last Post: December 28th, 2009, 12:19 PM