Results 1 to 8 of 8
Thread: Urgent small code
- 08-04-2008, 12:48 AM #1
Member
- Join Date
- Aug 2008
- Posts
- 1
- Rep Power
- 0
Urgent small code
write a infinite loop ,inside loop,A will write K numbers to array,
K is Random and all the numbers are number,B will read M numbers and print them out
a) note that B generate M and M must be smaller than the array size at any time
b) note that A generate K and K must be smaller than 10
c) Note tha the array size is fixed tobe 100, if it is full, A will not write anymore.
Can you please give me this code it is damn urgent pleaseeeeeeeeeeeee
- 08-04-2008, 02:23 AM #2
You send me $1000 and I'll get right at it as soon as I see the money.
- 08-04-2008, 03:30 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
What you have tried karingulanagaraj so far. No one here to write codes for you. Try something and if you fail to get there ask any question here. What you have done so far? Are you stuck with an infinite loop?
- 08-04-2008, 05:26 AM #4
Also, see @Eranga's sig, your topic is poorly worded
- 08-08-2008, 08:49 PM #5
Member
- Join Date
- Aug 2008
- Posts
- 3
- Rep Power
- 0
Program for Above.
/**
* write a infinite loop ,inside loop,A will write K numbers to array,
* K is Random and all the numbers are number,B will read M numbers and print them out
* a) note that B generate M and M must be smaller than the array size at any time
* b) note that A generate K and K must be smaller than 10
* c) Note that the array size is fixed to be 100, if it is full, A will not write anymore.
*/
package general;
import java.util.Random;
public class Miscelleneous {
public static void main(String args[]) {
callConfusion();
}
static int arraylength = 0;
public static void callConfusion() {
int array[] = new int[100];
System.out.println("Array Length" + array.length);
Random randomGenerated = new Random();
int K;
boolean flag = true;
while (flag) {
K = randomGenerated.nextInt(10);
System.out.println("Randomly Generated number : " + K);
for (int A = 1; A <= K; A++) {
arraylength ++;
//System.out.println("Arraylenght :" + arraylength);
if(arraylength == 100) { flag = false; break;}
array[arraylength] = A;
}
}
/**************To Print 100 Array Values*********************/
for(int i=0;i<100;i++){
System.out.print(array[i] + " ");
}
int M = randomGenerated.nextInt(array.length);
System.out.println("B is printing the randomly generated numbers of " + M + "here.");
for (int B = 1; B < M; B++) {
System.out.print(B + " ");
}
}
}
- 08-08-2008, 08:59 PM #6
- 08-11-2008, 04:04 AM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Hi gedelakranthi, you should clearly specified your question. Then we can help you to solve it. No one here ready write codes for you. Simply explain your question, what you are expecting and what you get on your code?
- 08-11-2008, 04:11 AM #8
Member
- Join Date
- Jul 2008
- Posts
- 33
- Rep Power
- 0
I guess i'm too late to help since it was urgent.
:DMy community with sourcode and examples :D
Java remote image server/client working proof of concept: uitstekendeaccu.nl/tmp/
Similar Threads
-
Small problem
By ayoood in forum New To JavaReplies: 2Last Post: 06-06-2008, 12:27 PM -
small error
By ayoood in forum New To JavaReplies: 23Last Post: 05-27-2008, 12:18 PM -
small issues with a program
By jimJohnson in forum New To JavaReplies: 6Last Post: 04-25-2008, 08:28 AM -
Small scale Java Editor
By Greenfrog99 in forum AWT / SwingReplies: 0Last Post: 01-27-2008, 08:46 PM -
Small tennis simulation in Java
By diego in forum New To JavaReplies: 1Last Post: 12-02-2007, 01:32 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks