Question
Background Design and construct Java programs according to standard object-oriented principles Apply and demonstrate debugging processes to Java applications Develop strategies for efficient and effective
Background
- Design and construct Java programs according to standard object-oriented principles
- Apply and demonstrate debugging processes to Java applications
- Develop strategies for efficient and effective program testing(With written format)
- Document code according to specific programming standards
- Identify and apply the "object-oriented" concepts of encapsulation, abstraction and polymorphism
- Explain and apply software engineering principles of maintainability, readability and modularisation
The bilby, otherwise described as Australia's Easter Bunny, is a ground dwelling marsupial. 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.
The purpose of program is 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. 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
Content inside the population.txt file
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started