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 =...
Type: Posts; User: dmanmeds
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 =...
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...
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...
I have updated it with some comments. Hope it clarifies what I was trying to do
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...
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...
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...
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...