Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Cryptogram Program help!

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Cryptogram Program help!

    I have to write a program that will solve the string below that contains a cryptogram. I'm not really sure where to start. Any suggestions?







    public class CryptoSolverSolution {

    public static void main(String[] args){

    double[] freq = {146,7,36,59,134,33,20,54,119,24,4,63,31,109,102,3 4,1,49,95,103,35,26,16,2,10,0};
    String cryptogram = "QYUY (BKFCKNWBYK: QYGY) BW YK BWTYKF CS BKFCKNWBY. GBOX Y VCVJTYOBCK CS 135 HBTTBCK (NDZTJFBKP OXN 3.6 HBTTBCK BK OXN BWTYKF CS HYFJIY GXBZX BW YFHBKBWONINF YW VYIO CS OXN VICUBKZNW CS QYUY), QYUY BW OXN GCITF'W HCWO VCVJTCJW BWTYKF, YKF CKN CS OXN HCWO FNKWNTA-VCVJTYONF VTYZNW CK OXN PTCLN. QYUY BW OXN XCHN CS 60 VNIZNKO CS OXN BKFCKNWBYK VCVJTYOBCK. OXN BKFCKNWBYK ZYVBOYT ZBOA, QYEYIOY, BW TCZYONF CK GNWONIK QYUY. HJZX CS BKFCKNWBYK XBWOCIA OCCE VTYZN CK QYUY. BO GYW OXN ZNKONI CS VCGNISJT XBKFJ-LJFFXBWO NHVBINW, OXN BWTYHBZ WJTOYKYONW, YKF OXN ZCIN CS OXN ZCTCKBYT FJOZX NYWO BKFBNW. QYUY GYW YTWC OXN ZNKONI CS OXN BKFCKNWBYK WOIJPPTN SCI BKFNVNKFNKZN FJIBKP OXN 1930W YKF 40W. QYUY GYW YTWC CZZJVBNF LA OXN BHVNIBYT QYVYKNWN YIHA SICH 1942 OXICJPX OXN FNSNYO CS OXN QYVYKNWN NHVBIN BK 1945, YKF OXBW VJO Y ONHVCIYIA NKF OC YTT OXCJPXOW CSBKFNVNKFNKZN. QYUY FCHBKYONW BKFCKNWBY'W WCZBYT, VCTBOBZYT, YKF NZCKCHBZ TBSN. SCIHNF HCWOTA YW OXN INWJTO CS UCTZYKBZ NIJVOBCKW, QYUY BW OXN 13OX TYIPNWO BWTYKF BK OXN GCITF YKF OXN SBSOX TYIPNWO BWTYKF BK BKFCKNWBY. Y ZXYBK CS UCTZYKBZ HCJKOYBKW SCIHW YK NYWO-GNWO WVBKN YTCKP OXN BWTYKF. BO XYW OXINN HYBK TYKPJYPNW, OXCJPX QYUYKNWN BW FCHBKYKO, YKF BO BW OXN KYOBUN TYKPJYPN CS YLCJO 60 HBTTBCK VNCVTN BK BKFCKNWBY, HCWO CS GXCH TBUN CK QYUY. HCWO CO BOW INWBFNKOW YIN LBTBKPJYT, GBOX BKFCKNWBYK YW OXNBI SBIWO CI WNZCKF TYKPJYPNW. GXBTN OXN HYQCIBOA CS OXN VNCVTN CS QYUY YIN HJWTBH, QYUY XYW MJBON Y FBUNIWN HBDOJIN CS INTBPBCJW LNTBNSW, NOXKBZBOBNW, YKF ZJTOJINW. QYUY BW FBUBFNF BKOC SCJI VICUBKZNW, GNWO QYUY, ZNKOIYT QYUY, NYWO QYUY, YKF LYKONK, YKF YTWC OGC WVNZBYT FBWOIBZOW, QYEYIOY YKF ACPAYEYIOY.";



    /* CODE HERE */


  2. #2
    Junior Member
    Join Date
    Apr 2012
    Posts
    8
    My Mood
    Where
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Cryptogram Program help!

    Is that all the information the teacher gave you about cryptograms and how to solve them?

    doing a quick google search I found a solver that did solve the string but the code was quite extensive and the algorithm involved seems way beyond a simple class assignment... This is why I feel like you might have left out some more information from your instructor.

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Cryptogram Program help!

    Did the instructor give you any clues?
    If you don't understand my answer, don't ignore it, ask a question.

  4. #4
    Junior Member
    Join Date
    Apr 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Cryptogram Program help!

    Sorry here is a what he said:


    Your job is to complete the program so that it will solve the cryptogram, and print the decoded string.

    Your solution must be a complete class, enclosing main.
    Please keep the name of the class as CryptoSolver.

    A suggestion: Get the complete solution running to your satisfaction in your Java development environment.
    Then copy the source code to your clipboard and paste the entire text in the box below.
    (note: do not use any include statements in your submission).

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Cryptogram Program help!

    So all the instructor said was: solve it. You have no other clues?
    What does the freq array contain?

    To get some info, count the occurrences of all the letters in the String:
    create an array with 26 (1 per letter) elements, write a loop to go through the given String, get each char from the String, convert it to an index by subtracting 'A', test if in range (0-25) and add one to the array at that index. Print out the contents of the array at the end and compare it to the freq array's contents.
    Last edited by Norm; April 5th, 2012 at 04:38 PM.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Program to launch and mirror another program
    By hayate in forum Java Theory & Questions
    Replies: 13
    Last Post: March 9th, 2012, 12:47 AM
  2. Help with class program!!! STUCK! Program not doing what I Want!!!
    By sketch_flygirl in forum What's Wrong With My Code?
    Replies: 7
    Last Post: April 4th, 2011, 07:29 AM