Results 1 to 11 of 11

Thread: Help ..

  1. #1
    Dnav is offline Member
    Join Date
    Apr 2011
    Posts
    5
    Rep Power
    0

    Default Help ..

    Hi ..
    how are you ?
    umm , my teacher asked me to write this program , and i don't know how can i use any method to to count each row alone ..
    pleas if any one can write or explain this to me I'll be thanx : )

    Attached Thumbnails Attached Thumbnails Help ..-1115.jpg  

  2. #2
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Posts
    339
    Rep Power
    7

    Default

    The 'Logic' section of the question is gibberish.

  3. #3
    Dnav is offline Member
    Join Date
    Apr 2011
    Posts
    5
    Rep Power
    0

    Default

    Quote Originally Posted by dlorde View Post
    The 'Logic' section of the question is gibberish.
    really ?
    maybe he made a mistake
    the main idea from the question isn't clear ? :(

  4. #4
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Posts
    339
    Rep Power
    7

    Default

    Quote Originally Posted by Dnav View Post
    really ?
    maybe he made a mistake
    You think?

    the main idea from the question isn't clear ? :(
    Perhaps you could explain it to me as you understand it, because it's not clear to me.

    My view is that programming can be hard work, and I want to be absolutely sure before doing any hard work that I understand exactly what I'm supposed to do.

  5. #5
    Dnav is offline Member
    Join Date
    Apr 2011
    Posts
    5
    Rep Power
    0

    Default

    Perhaps you could explain it to me as you understand it, because it's not clear to me.
    He didn't explain to us ..

    Perhaps you could explain it to me as you understand it, because it's not clear to me.

    My view is that programming can be hard work, and I want to be absolutely sure before doing any hard work that I understand exactly what I'm supposed to do.
    yes , I know that .

    I work hard to order my ideas but i don't know what should I do first .
    umm , Can we try to understand and write it together ?
    if you want . :o

  6. #6
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    The logic description isn't great, however; the input output examples are helpful.

    Seems like the goal is to take a string array and a search term, then, for each element in the array you want to find the number of times the search term is found. You then add that to a new string array and continue. Finally you return the array. Try something out and show us your attempts
    [code]
    YOUR CODE HERE
    [/code]

    Use code tags like above when posting code.

    Java Code:
    declare string array
    loop
      loop
        search for number of times search term was found
      end loop
      add string to return array
    end loop

  7. #7
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Posts
    339
    Rep Power
    7

    Default

    Quote Originally Posted by sunde887 View Post
    The logic description isn't great, however; the input output examples are helpful.
    Yeah, I know; it just irritates me that students have to code precisely, down to the level of punctuation, but some tutors blithely provide such sloppy gibberish for requirements.

  8. #8
    Dnav is offline Member
    Join Date
    Apr 2011
    Posts
    5
    Rep Power
    0

    Default

    Look how I see it .

    The method should starts from first row and looking for the search word, and when it find the search word the counter became 1 , until the end of this row it prints this " word" (search word) "found" (counter) "time"
    and down to another row and do the same thing , umm, do you think the counter should be zero whenever down a new row ?
    is that right ?
    sorry but I'm new in java .. :(

    The logic description isn't great, however; the input output examples are helpful.
    Yes , I'm wrote this from the table or whatever .

    Thank you very much . ^^
    Last edited by Dnav; 04-29-2011 at 05:22 PM.

  9. #9
    Dnav is offline Member
    Join Date
    Apr 2011
    Posts
    5
    Rep Power
    0

    Default

    Quote Originally Posted by dlorde View Post
    Yeah, I know; it just irritates me that students have to code precisely, down to the level of punctuation, but some tutors blithely provide such sloppy gibberish for requirements.

    you are very right :(
    I've been crying alot .
    Last edited by Dnav; 04-29-2011 at 04:28 PM.

  10. #10
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,524
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by dlorde View Post
    Yeah, I know; it just irritates me that students have to code precisely, down to the level of punctuation, but some tutors blithely provide such sloppy gibberish for requirements.
    I think it was just the OP's sloppy interpretation of the given requirements.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  11. #11
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    I believe I am going to have to side with jos. That logic description seems a bit jumbled, is that actually the exact handout your teacher gave you? If it is I am pretty surprised that the logic isn't a bit more concise.

    One important thing is to think about the problem constantly. The better you understand it, the easier the coding process will begin.

    Each element in the array is a string, so you could make a method, or have your logic take two strings, search term, and the to be searched string. From there you can count the number of occurrences of the search term in the original string.

    This is breaking the problem down to a smaller problem. Once you do this it shouldn't be hard to expand this onto multiple items in the array.

    Java Code:
    public int countString(String toBeSearched, String searchTerm)
    then this method could be used in the other method. Alternatively, you don't need to use this method, but writing it should be helpful. For new programmers nested loops can be confusing and doing it this way does use nested loops but it allows you to think about them separately.

    Finally, my pseudo code above should be very helpful. Also, consider asking for clarification from the teacher.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •