Results 1 to 4 of 4
  1. #1
    dipak200529 is offline Member
    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    Default Java programming 1

    Use multithreading in Java to solve the following problem:

    In a kitchen there is a basket which can store upto 50 average sized apples. The inmates (5 of them) all have access to it whenever they feel hungry. But there is a common money bag where they have decided to pay back the price of each apple they take. The current price is written on a hanging board by the person who buys as many as possible (not exceeding 50) from the money available in the bag. The task of buying falls on the person who eats up the last apple. The price may be allowed to fluctuate between two reasonable rates by some pseudo-random number generated through an appropriate routine. The same can be applied for estimating the appetite of the inmates i.e. how many apples they take at each go.

    Assume an initial stock of 50 apples. The whole scheme should last till each inmate has had at least one turn at buying. Provide some technique to ensure that there is no controversy as to who ate the last apple at any point of time.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Java programming 1

    I think that I speak for all in saying that we wish you much success in solving this homework problem. Please do come back and let us know how it turns out. Also feel free to come back if you have any specific questions over this, but if you do, please also show the fruits of your efforts as well. Else we won't be able to tell what you're doing wrong and what concepts you are unclear on.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,239
    Rep Power
    19

    Default Re: Java programming 1

    Thread moved from a staff-only section.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. android programming vs game programming using java
    By vgoel38 in forum Forum Lobby
    Replies: 2
    Last Post: 09-08-2012, 12:11 AM
  2. Replies: 1
    Last Post: 05-31-2009, 10:57 PM
  3. Replies: 1
    Last Post: 05-31-2009, 02:17 PM
  4. Replies: 16
    Last Post: 05-28-2009, 03:41 PM

Tags for this Thread

Posting Permissions

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