Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2008
    Posts
    1
    Rep Power
    0

    Default 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

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,792
    Rep Power
    25

    Default

    You send me $1000 and I'll get right at it as soon as I see the money.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    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?

  4. #4
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Also, see @Eranga's sig, your topic is poorly worded

  5. #5
    gedelakranthi is offline Member
    Join Date
    Aug 2008
    Posts
    3
    Rep Power
    0

    Default 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 + " ");
    }
    }
    }

  6. #6
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by gedelakranthi View Post
    code for above
    Why did you post this? The OP is rude, asking for homework, and has shown zero effort.

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    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?

  8. #8
    Join Date
    Jul 2008
    Posts
    33
    Rep Power
    0

    Default

    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

  1. Small problem
    By ayoood in forum New To Java
    Replies: 2
    Last Post: 06-06-2008, 01:27 PM
  2. small error
    By ayoood in forum New To Java
    Replies: 23
    Last Post: 05-27-2008, 01:18 PM
  3. small issues with a program
    By jimJohnson in forum New To Java
    Replies: 6
    Last Post: 04-25-2008, 09:28 AM
  4. Small scale Java Editor
    By Greenfrog99 in forum AWT / Swing
    Replies: 0
    Last Post: 01-27-2008, 09:46 PM
  5. Small tennis simulation in Java
    By diego in forum New To Java
    Replies: 1
    Last Post: 12-02-2007, 02:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •