Results 1 to 12 of 12
  1. #1
    White is offline Member
    Join Date
    Aug 2009
    Posts
    4
    Rep Power
    0

    Default Anyone can help??

    hi everyone newbie here :D

    I had cryptography program to used netbeans ide as assignment in my college. But i can't do that, because the lecturer did'nt teach yet.

    Look at this command :

    Write a method that receives a String as its only parameter and return the encrypted String. Call this method Encryption_mthd. (Hint: public String Encryption_mthd(String str){}).

    Write another method that receives a encrypted String and return the decrypted String (the original text). Call this method Decryption_mthd. (Hint: public String Decryption_mthd(String str){})

    Write a menu that asks user for input statement to be encrypted, and then show the encrypted text, and lastly per user request, decrypt it back to its original format. (Program will exit if the user insert 0).

    How to 'Encrypt a String'?

    1. Convert the String parameter into an array of characters.
    2. Find out the equivalent integer for each character of the String parameter. (Using ASCII table).

    3. Assuming the equivalent integer is stored in an integer variable called 'asciii_value'. Using the following formula calculate the encrypted integer (StudentID is equal to your last two digits of your student ID. for example if your student ID is 109087625, Student id will be 25):
    int encrypted_integer = ((ascii_value + student iID) % 95) +32;


    4. Then replace the equivalent char of the encrypted_integer using ASCII table with the current character.

    5. Convert the array of characters into new String and return the new String.

    'How to Decrypted a string'?

    1. Convert the String parameter into an array of characters
    2. Fing out the equivalent integer for each characters of the String parameter. (Using ASCII table).

    3. Assuming the equivalent integer is stored is an integer variable called 'ascii_value'. Using the following formula calculate the decrypted integer (StudentID is equal to your last two digits of your Student ID. For example if your student ID is 109087625, Student id will be 25):

    int decrypted_integer = ((ascii_value-StudentID)+95);
    if (decrypted_integer > 158)
    {
    decrypted_integer % = 127;
    } else
    {
    decrypted_integer - = 32;
    }

    4. Then replace the equivalent char of the encrypted_integer using ASCII table with the current character.

    5. Convert the array of characters into new String and return the new String.

    note : please help me to solve this problem or give me some clue, because i don't have any idea about that. thanks

    regard_
    Last edited by White; 09-03-2009 at 05:17 PM.

  2. #2
    mrmatt1111's Avatar
    mrmatt1111 is offline Senior Member
    Join Date
    Aug 2009
    Location
    San Jose, CA, USA
    Posts
    320
    Rep Power
    5

    Default

    What exactly is your question and how does it relate to Netbeans? :)
    My Hobby Project: LegacyClone

  3. #3
    White is offline Member
    Join Date
    Aug 2009
    Posts
    4
    Rep Power
    0

    Default

    Quote Originally Posted by mrmatt1111 View Post
    What exactly is your question and how does it relate to Netbeans? :)
    the question is how to create a code using a netbeans....anyway thanks for posted.... :D

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

  5. #5
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

    Default

    exec netbeans.exe
    in menubar, File > New Project
    Categories should be Java, and Projects should be Java Application
    click Next
    enter Project Name, Location, main class name etc
    click Finish
    new Project created

    then you can right click on Source Packages to create new packages, class as you like

    you can now start your real programming work


    if you want to test your program, right click the project , build/ clean and build, then run

  6. #6
    cyber_ingush is offline Member
    Join Date
    Sep 2009
    Posts
    1
    Rep Power
    0

    Default

    It's funny, I'm doing the same question)))
    I guess we'r frm da same class)))))

  7. #7
    White is offline Member
    Join Date
    Aug 2009
    Posts
    4
    Rep Power
    0

    Default

    Quote Originally Posted by mtyoung View Post
    exec netbeans.exe
    in menubar, File > New Project
    Categories should be Java, and Projects should be Java Application
    click Next
    enter Project Name, Location, main class name etc
    click Finish
    new Project created

    then you can right click on Source Packages to create new packages, class as you like

    you can now start your real programming work


    if you want to test your program, right click the project , build/ clean and build, then run
    thx then, but i already knew it to do that, but i dont know how to create the algorithm

    Quote Originally Posted by cyber_ingush View Post
    It's funny, I'm doing the same question)))
    I guess we'r frm da same class)))))
    really? who are u actually?

  8. #8
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    The question tells you all the steps to be followed. It's already an algorithm?
    Have you tried to follow those steps at all?

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Quote Originally Posted by r035198x View Post
    Have you tried to follow those steps at all?
    From the sounds of it, no. Perhaps he should talk to the teacher at this point.

  10. #10
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

    Default

    for string to char array, please read Java API (String)
    for ascii, search the web

    have you read point 3 of How to 'Encrypt a String'?
    and that of 'How to Decrypted a string'? ...
    last 2 digit of your student id is the random seed of the encryption method
    suggest to use final static int to store it...

    your teacher give you everything...
    Last edited by mtyoung; 09-06-2009 at 04:27 PM.

  11. #11
    White is offline Member
    Join Date
    Aug 2009
    Posts
    4
    Rep Power
    0

    Default

    anyway thx all for revision i has been solved the problem with hint:
    Encypted : public String Decryption_mthd(String str){})

    Decypted : public String Encryption_mthd(String str){}).

    :D

  12. #12
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

Posting Permissions

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