The program is to simulate the variation in a bilby population over the course of one year. This section specifies the required functionality of the program.
Background
The bilby, otherwise described as Australia’s Easter Bunny, is a ground dwelling marsupial. Bilbies have grey fur, long ears, and a distinctive black and white tail. An adult bilby is about the same size as a small rabbit. One of the indigenous names for the bilby is nyarlku.
The bilby has been classified as a vulnerable species. Once occupying habitats in more than 70% of Australia, they are now only found in desert areas of northern Australia. Their main predators are introduced foxes and feral cats.
Wildlife conservationists are concerned that they know very little about the bilby populations and are worried their long-term survival. To understand more about the survival of the bilby and the effectiveness of strategies conservationists might use to help the survival of bilbies, in computer program to simulate variations in a bilby population over the course of a year.
We will assume the conservationists have gathered data from a number of areas in a desert in the Northern Territory. This data will be used at the start of the simulation. The simulation will update the population once a month. At the end of the year the program will display the population change and the population stability, which could be used to predict the long-term survival of the bilby.
Bilby survival simulation
The Bilby survival program will simulate one year of variation to a population of bilbies and their predators.
The simulation begins by displaying a brief welcome message.
The user is then prompted for the name of area that the population data has been collected from. The name can be up to 16 characters in length.
The numbers of bilbies, foxes and feral cats at up to 10 locations is read in from a file population.txt(Refer to below is the content). The file will contain one line for each location, with 3 comma separated numbers on each line, representing the numbers of bilbies, foxes and feral cats, respectively. There is no other reading from the file during the actual running of the program.
From this data, the program creates separate collections of bilbies, foxes and cats. Each animal will have a unique identification code, a location, and a status indicating whether it is alive or not. Foxes and cats will also have a health status. The details of these are as follows:
1. The unique identification code will be in the following format (where nnn represents a sequence of 3 digits):
Bnnn for bilbies
Fnnn for foxes
Cnnn for cats
2. The location will be an integer, with the line from the file representing the location. So, line 1 will be location 1, line 2 will be location 2, … and so on.
3. All animals will be alive at the start of the simulation.
4. The health status of foxes and cats will start at 3.
The simulation steps through 12 months. At each month the bilby population at each location is assessed, the conservationist makes any necessary interventions, and a summary of the bilby, fox, and cat populations at each location is displayed.
At the end of the year, the population stability is assessed, the population data at each location is displayed, and a summary is written to the file populationFinal.txt. The details written to the file will be the numbers of live and dead bilbies, foxes, and feral cats at each location. The file will contain one line for each location, with 6 comma-separated numbers on each line, representing the numbers of live bilbies, dead bilbies, live foxes, dead foxes, live feral cats, and dead feral cats, respectively.
Specific actions each month
Each month the following events may occur:
New bilbies may be born. The probability of each bilby giving birth to a new bilby is 0.15. (Hint: to calculate the probability of event, generate a random number from 1 to 100. There is a 1% chance of each of these numbers being generated so you can nominate numbers 1-15 for a bilby birth).
New foxes and cats may be born and added the population. The probability of each fox giving birth is 0.1. The probability of each cat giving birth is 0.2.
A live fox may eat a bilby at the same location. Each fox has a 0.4 probability of eating a bilby if there is at least one bilby at the fox’s location. If a fox eats a bilby then one bilby at the fox’s location has their alive status changed to false. If the fox doesn’t eat a bilby then the fox’s health status is reduced by one. If a fox’s health status is zero then their alive status is changed to false.
Similarly, a live cat may eat a bilby at the same location. Each cat has a 0.6 probability of eating a bilby if there is at least one bilby at the cat’s location. If a cat eats a bilby then one bilby at the cat’s location has their alive status changed to false. If the cat doesn’t eat a bilby then the cat’s health status is reduced by one. If a cat’s health status is zero then their alive status is changed to false.
After these events a summary of the population of live bilbies, foxes and cats at each location is displayed. At this point the conservationist may decide to:
relocate bilbies if their population at a location becomes too large. This involves changing the location of any bilbies in excess (more than 20). If excess bilbies are not moved then their alive status changed to false. Relocations may happen each month.
conduct an intervention to reduce the number of predators. This involves hunting the foxes and cats. If this happens then the probability of eliminating each animal is 0.5. Interventions are expensive and may only happen once a year.
Specific actions at the completion of observations at all locations
At the end of the simulation the following summary is displayed on the screen.
1. Population details at each location:
Numbers of live bilbies, foxes and cats
Numbers of bilbies, foxes and cats that have been born
Numbers of bilbies, foxes and cats that have died
2. Bilby population change:
( total_bilbies_at_end – total_bilbies_at_start) * 100/ total_bilbies_at_start
3. Bilby population stability factor:
(total_bilby_births + total_bilby_deaths) / total_bilbies_at_start
The closer to 0 this factor is, the more stable the population.
4. Predator population change (a predator is a fox or cat):
( total_predators_at_end – total_predators_at_start) * 100/ total_predators_at_start
Important Notes
Consider carefully your choice of classes, how they interact and the fields and methods of each class. You must use appropriate data structures to store the various objects (bilby, fox, location, etc.) in the program. You must make use of both Arrays and ArrayLists in your program.
Validation of values for fields and local variables should be implemented where appropriate. You should not allow an object of a class to be set to an invalid state (i.e. put some simple validations in your mutator methods).
Your program should handle incorrect or invalid input and present the user with relevant error messages. No invalid input should crash the program.
Exception handling should be used where appropriate.
Design and construct Java programs according to standard object-oriented principles
Develop strategies for efficient and effective program testing(Especially for Bilbies
Identify and apply the “object-oriented” concepts of encapsulation, abstraction and polymorphism
Explain and apply software engineering principles of maintainability, readability and modularisation
Population.txt content as below
12,1,2
5,2,0
19,3,3
20,4,2
17,1,0
9,1,2
14,1,4
8,3,0
19,1,2
8,0,2