need some help............programmes r flying above my head

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lost in java
    New Member
    • Dec 2007
    • 1

    need some help............programmes r flying above my head

    Enter a string(by the user) and encode it n then again decode it according to the digit entered by the user.........E. g.--String str = "123"
    int entereddigit=5
    so............. ............... ..encoding is--678 n decoding is---123
    plz do help its urgent
  • heat84
    New Member
    • Nov 2007
    • 118

    #2
    Can you write your code, when you are stuck , the experts will be glad to help.

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by Lost in java
      Enter a string(by the user) and encode it n then again decode it according to the digit entered by the user.........E. g.--String str = "123"
      int entereddigit=5
      so............. ............... ..encoding is--678 n decoding is---123
      plz do help its urgent
      I understand you want to add the int value 5 (or any other digit value) to each
      character in the String to be encoded?

      kind regards,

      Jos

      Comment

      • dav3
        New Member
        • Nov 2006
        • 94

        #4
        Originally posted by Lost in java
        Enter a string(by the user) and encode it n then again decode it according to the digit entered by the user.........E. g.--String str = "123"
        int entereddigit=5
        so............. ............... ..encoding is--678 n decoding is---123
        plz do help its urgent
        Well your going to need 2 functions. An encoding function and a decoding function. You are going to have to find a way to add an integer to a string (using scanner class to get the user input might help you on this).

        Your encode function you are obviously adding 5 to each character in the string, so your decode function will naturally do the opposite (subtraction).

        Comment

        Working...