Search:

Type: Posts; User: dmanmeds

Search: Search took 0.09 seconds.

  1. Replies
    18
    Views
    808

    Re: help with this question

    Yes " the letter is at a position of the String that is divisible by 4 "
    is related to this code

    if( s.length() % 4 == 0){


    String "Hello There!"
    gets turned into "hello there!" via s =...
  2. Replies
    18
    Views
    808

    Re: help with this question

    I need it to multiply the score by 2 , if the letter is at a position of the String that is divisible by 4 (0,4,8,16,...)
    in this case "Hello There!"
    'H' has a score of 4 but since 0 (the position...
  3. Replies
    18
    Views
    808

    Re: help with this question

    this fixed the out of bounds error I had before, when a non letter (space, comma,ect) was trying to be scored. This way, when the for loop executes
    if it comes across a non letter then it will just...
  4. Replies
    18
    Views
    808

    Re: help with this question

    I have updated it with some comments. Hope it clarifies what I was trying to do
  5. Replies
    18
    Views
    808

    Re: help with this question

    I got it to count the String with non letters.
    but when I add the if statement to try to double the value when the String is divisible by 4, it doesn't produce the correct answer
    I do not get...
  6. Replies
    18
    Views
    808

    Re: help with this question

    technically this works for adding the letters but it only works if there is no space between the words. When I put the spaces in between the words I get the out of bounds error. I tried accounting...
  7. Replies
    18
    Views
    808

    Re: help with this question

    sorry about the confusion. This is just one part of a whole big problem I have to do but assigning the letters to scores was something I was not sure how to do.
    I tried doing this but I still get an...
  8. Replies
    18
    Views
    808

    help with this question

    I am given a string "Hello World!"
    and an array, int[ ] scores = {1,3,3,2,1,4,2,4,1,8,5,1,3,1,1,3,10,1,1,1,1,4,4,8,4,10};
    the scores should corresponds to letters in the alphabet a=1, b=3,c=3...
Results 1 to 8 of 8