Loading ...
Sorry, an error occurred while loading the content.

Plese help me to solve this problem I am trying from 2 days

Expand Messages
  • bhavna_coolinus
    Write classes to represent 3 different types of Bee - Worker, Queen and Drone. Each Bee has a floating-point health property, which is not writable externally
    Message 1 of 1 , May 1, 2008
    • 0 Attachment
      Write classes to represent 3 different types of Bee - Worker, Queen
      and Drone.
      Each Bee has a floating-point health property, which is not writable
      externally and
      upon creation is set to a value of 100 (percent).
      Each Bee has a Damage() method that takes a single integer parameter
      that should be
      a value between 0 and 100. When this method is called, the health of
      the bee is to be
      reduced by that percentage of their current health.
      When a Worker has a health below 70% it cannot fly and therefore is
      pronounced
      Dead. When a Queen has a health below 20%, or a Drone below 50%, it is
      pronounced dead. This 'Dead' property should be readable from each
      Bee. When a
      Bee is dead, no further health deductions should be recorded by the
      bee, although the
      Damage() method should still be invokable without error.
      Your application should create a single list containing 10 instances
      of each type of
      Bee. It must support methods to allow Damage() to be called for each
      Bee, and to
      return the health status of each bee, including whether it is alive or
      not.
      The user interface should show the current status of each bee and
      contain a button.
      When clicked, a different random value between 0 and 80 should be
      selected for each
      bee and applied with a call to Damage(). After each click the page
      should refresh to
      show the health status of the bees.


      -----------------
      I have created the base class Bee and three different derived class of
      three types of Bees.

      but my question is how can I store the last helth persontage to check
      weather bee is dead or not, bcoze once bee is dead there should not be
      any further deduction in helth value.... also every time page should
      refresh and when user click button.

      so my problem is if page refreshes every time then every time new
      instance of class is going to create and i never be able to maintain
      health status of Bee....

      I donn know whether I am not getting the question properly or or I
      donn know the solution... Plese let have some idea how can i solve
      this problem?


      Thanks in advance
      Bhavna.
    Your message has been successfully submitted and would be delivered to recipients shortly.