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: need logic

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Location
    West Bengal, India
    Posts
    29
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default need logic

    I need logic for the following program. please help me

    Question :
    Accept 2 strings and check how many times the second string is in the first string.

    Example1:

    Enter main string : This is a dog which is angry. This is a dog which eat much.

    Enter string to check: This is a dog
    output
    2 times the 2nd string is present in the main string.


  2. #2
    Junior Member
    Join Date
    Nov 2011
    Location
    California
    Posts
    3
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default Re: need logic

    This code:
    ...edited by moderator
    will produce this result:
    "This is a dog" was found 2 times
    Last edited by copeg; November 27th, 2011 at 05:39 PM.

  3. The Following User Says Thank You to murphym18 For This Useful Post:

    arunjib (November 27th, 2011)

  4. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: need logic

    @murphym18 Are you trying to help the student pass his course by doing his homework for him?
    Would it be better for him if you tried to help him learn how to program. Copy and paste is not learning.

    Would you fly on a plane where the pilot learned to fly by copy and pasting?

    Read this:
    http://www.javaprogrammingforums.com...n-feeding.html

  5. The Following User Says Thank You to Norm For This Useful Post:

    copeg (November 27th, 2011)

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

    Default Re: need logic

    @murphym18, in addition to Norm's post above, please read the forum rules (as a result, your post has been edited)

    @arunjib, someone may have handed you code - I do hope you spend the time to understand the code and know that should this be for a class could be considered academic dishonesty (in other words - cheating)

Similar Threads

  1. Logic issue(I believe) stumped
    By mwr76 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: September 23rd, 2011, 01:19 AM
  2. Problem with the Logic
    By sudh in forum Java Theory & Questions
    Replies: 4
    Last Post: March 31st, 2011, 07:21 AM
  3. whats logic behind this?
    By X0X0 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 26th, 2011, 02:48 PM
  4. Help with java logic
    By dever in forum What's Wrong With My Code?
    Replies: 7
    Last Post: February 7th, 2011, 08:41 AM
  5. Need Help with Operators/ logic
    By codekiller in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 3rd, 2010, 09:25 AM