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 2 of 2

Thread: How to convert this pseudo code into JAVA

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to convert this pseudo code into JAVA

    D = 1
    coeff_array[0] = select random integer between -5 and 5
    coeff_array[1] = select random integer between -5 and 5
    coeff_array[2] = select random integer between -5 and 5
    D = 2
    coeff_array[0] = select random integer between -10 and 10
    coeff_array[1] = select random integer between -10 and 10
    coeff_array[2] = select random integer between -10 and 10
    D = 3
    remove an integer k from {0,1,2} at random
    let remaining array be {p, q}
    coeff_array[p] = select random integer between -15 and 15
    coeff_array[q] = select random integer between -15 and 15
    To find coeff_array[k]:
    {
    j = select a random integer from the set {2,3,5,6,7}
    string sign = + or - (select one of the two at random)
    string coeff_array[k] = "sign" + "r" + j;
    }
    D = 4
    to select coeff_array[0]
    select an integer i at random from 1 to 100
    if i < 50
    coeff_array[0] = select random integer between -20 and 20
    else
    j = select a random integer from the set {2,3,5,6,7,8,10,11,12,13,14,15}
    string sign = + or - (select one of the two at random)
    int multiplier = select a random integer from {2,3,4,5}
    string coeff_array[0] = "sign" + "multiplier" + "r" + j;
    Similarlly, select coeff_array[1] and coeff_array[2]


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,130
    Thanks
    52
    Thanked 2,286 Times in 2,257 Posts

    Default Re: How to convert this pseudo code into JAVA

    What have you tried?
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. pseudo code and algorithms
    By oonagh in forum What's Wrong With My Code?
    Replies: 6
    Last Post: December 3rd, 2012, 10:23 AM
  2. i need explanation in pseudo code
    By abood1190 in forum Loops & Control Statements
    Replies: 7
    Last Post: June 20th, 2012, 11:02 AM
  3. pseudo Code Help
    By shamil max in forum Java Theory & Questions
    Replies: 1
    Last Post: March 27th, 2012, 09:08 AM
  4. HELP WITH PSEUDO CODE
    By pronk123 in forum Member Introductions
    Replies: 0
    Last Post: December 14th, 2010, 08:30 AM
  5. Pseudo code of insertion sort linked list
    By sungirl in forum Algorithms & Recursion
    Replies: 1
    Last Post: May 23rd, 2010, 09:25 AM