A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • one year ago

writing java code return the next character of string which the user input it ex : the input = tee the output = uff

  • This Question is Closed
  1. e.mccormick
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Well, are you going to wrap from z to a and what about caps vs lower case?

  2. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    yes from z to a ..their is no problem if it lower case or upper case

  3. e.mccormick
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I am not sure what you mean by "their is no problem if it lower case or upper case" because to a computer they are completely different things. In Java, a char is basically an unsigned short. If you add one to it, it becomes the next letter. However, if you are on z or Z, it will become something that is not what you want. In those cases, you can just change it to a or A as needed with an if statement. Now, if you need it to be able to account for other things than just adding one, then it takes a bit more work.

  4. e.mccormick
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Also, with youe example you will want to itterate the string. That means findinf the string length and then walking through it one character at a time. You can use string.length() and string.charAt() with a loop to do this.

  5. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.