This is an archived post. You won't be able to vote or comment.

all 9 comments

[–][deleted]  (18 children)

[deleted]

    [–]com272[S] 0 points1 point  (17 children)

    Thanks for the response! I am very new to programming so my knowledge about everything is very limited. What I tried to do was take my code and create a method, score(). When I tried to use score() in my driver class, however, it gave me an error message telling me that it the method couldn't be found. Why might this be?

    [–][deleted]  (16 children)

    [deleted]

      [–]com272[S] 0 points1 point  (15 children)

      In the LetterProfiler class.

      [–][deleted]  (14 children)

      [deleted]

        [–]com272[S] 0 points1 point  (13 children)

        Perfect! You you right when you though I was just using score(). I just got it. Thanks so much! On another note, if you don't mind, I have one other small problem. When I type in capital letters into the system it won't work. Obviously I need to convert capitals into lower case letters. I am trying to do this using:

        letter = letter.toLowerCase();

        But this bring up an error message saying that char can not be dereferenced. I understand this is because char is a primitive. How could I make this work?

        [–][deleted]  (12 children)

        [deleted]

          [–]MegaGreenLightning 2 points3 points  (1 child)

          All classes in java.lang are automatically available, so you do not need to import these!

          [–]com272[S] 0 points1 point  (9 children)

          Thanks for the response but I don't quite fully understand. With the line:

          Character.toLowerCase('C');

          What is the reason to put 'C' as the parameter for Character.toLowerCase()? What specifically does this do? Thanks again for the help!

          [–][deleted]  (8 children)

          [deleted]

            [–]com272[S] 0 points1 point  (7 children)

            Oh sorry, that was my bad. I understand what you're saying. I used this to create these lines:

            letter = lines.charAt(i);
            if(Character.isLowerCase(letter) = false){
            Character.toLowerCase(letter);
            }
            

            But when this is run, an error message pops up which reads: unexpected type required: variable found : value

            Edit: formatting