Results 1 to 3 of 3
  1. #1
    scottydogg9 is offline Member
    Join Date
    Sep 2008
    Location
    Minnesota
    Posts
    1
    Rep Power
    0

    Default Java "Encryption"

    I've just started learning to use java through a computer science class at my college. Basically what I am trying to do is get from a 5 letter word entered by a user to turn all the letters of that word into it's ascii codes. I'm just looking for some hints as to which codes I should use cause I don't understand what they all do yet. I'm allowed to use sources to help me get the commands or whatever they're called so for those of you who think I'm cheating... I'm not. I just can't understand those Java API sites since I'm new to it and all.

    import java.util.Scanner;

    public class SimpleEncryption {

    public static void main(String [] args) {

    String s;
    Scanner input = new Scanner(System.in);
    int a,b,c,d,e; //for ascii code storage

    System.out.println("Enter your five character secret message: ");

    s = input.next();


    a = ??;
    b = ??;
    c = ??;
    d = ??;
    e = ??;

    System.out.print("Your word in ASCII codes: ");
    System.out.println(??);





    }



    }

  2. #2
    racerxadam is offline Member
    Join Date
    Jul 2008
    Posts
    68
    Rep Power
    0

    Default

    google java string to ascii, i'm sure you will find numerous code examples

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,617
    Rep Power
    25

    Default

    turn all the letters of that word into it's ascii codes
    Can you give an example of what an ascii code is for a letter?

    Hint: a char can be treated as/converted to an int.
    int aVar = 'a'; // assign char value to an int

Similar Threads

  1. Hwlp with "Open", "Save", "Save as..."
    By trill in forum New To Java
    Replies: 3
    Last Post: 11-02-2010, 10:26 AM
  2. <core:forEach var="" begin="+<%=j%>+">???
    By freddieMaize in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 09-27-2008, 02:20 AM
  3. "Jumble" or "Scramble" Program
    By Shadow22202 in forum Java Applets
    Replies: 8
    Last Post: 04-30-2008, 04:42 AM
  4. Replies: 1
    Last Post: 07-27-2007, 11:59 PM
  5. Replies: 1
    Last Post: 07-16-2007, 07:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •