User Profile
Collapse
-
searching and sorting
I have to create a program that creates 5 or 6 vertical bars of different heights using an array. And the bars need to be lined up across the page which is what I'm having trouble with. The rest of the program I believe I can do, which is then creating a timer and action listener so that it compares the first bar to the second bar and then if teh second is shorter the bars switch and it does this till all teh bars are sorted from shortest to tallest.... -
Thanks for your help I still wasn't able to get it lol I don't think i'll ever survive this java class but it was due last night and I just turned it what I had. Thanks though for helpin. -
The above code needs some serious surgery. I think what you're trying to do can be accomplished in the following steps:
1) Declare variables - int num, final int NUMBERS, and int[] array.
2) for...loop from 0 to < NUMBERS (index i)
2) a. Generate a random number from 0 to 50 - store into num
2) b. Set the ith member of array to num (array[i] = num;).
2) c. Output array[i].
This is all...Leave a comment:
-
Need some help Please
I'm working on this program for class where I have to an amount of numbers that are randomly picked from 0 - 50. So what I have done is say there are 20 slots in my array so I'm trying to generator 20 random numbers for the array between 0-50 however I've ran into a few problems. Mainly figuring out how to make it print 20 seperate completely random numbers into the array. So here is what I have any help will be greatly appreciated. Thank you.... -
java decision statements
Its a simple problem really but I can't remember for the life of me the code for "or" I know && is used for and. Basically I have to write a program that tells accepts side lengths of a triangle and then tells what type of triangle it is. So for example (num1 = num2 or num1 = num3); whats the code for or. Thanks.
No activity results to display
Show More
Leave a comment: