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.

# Thread: How to convert this pseudo code into JAVA

1. ## How to convert this pseudo code into JAVA

D = 1
coeff_array = select random integer between -5 and 5
coeff_array = select random integer between -5 and 5
coeff_array = select random integer between -5 and 5
D = 2
coeff_array = select random integer between -10 and 10
coeff_array = select random integer between -10 and 10
coeff_array = 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
select an integer i at random from 1 to 100
if i < 50
coeff_array = 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 = "sign" + "multiplier" + "r" + j;
Similarlly, select coeff_array and coeff_array  Reply With Quote

3. ## Re: How to convert this pseudo code into JAVA

What have you tried?  Reply With Quote