Koala Rescue

Specification

For this assignment you will simulate the work of a koala rescue team. This section specifies the required functionality of the program

Background

The koala is a marsupial and is native to Australia. Koalas typically live in open eucalyptus (gum tree) forests. Koalas live mainly in trees and eat up to 1 kg of leaves per day. Their diet is restricted to a few varieties of gum trees (e.g., Manna Gum, Swamp Gum, Blue Gum, and River Red Gum). Koalas use some other varieties of trees (e.g. Wattle) for shelter on hot days. Only one koala at a time will occupy a shelter tree. Whilst moving on the ground between trees, koalas are exposed to attacks from predators.

After bushfires in January 2020, several koala reserves were left devastated when forest habitat burnt leaving many koalas dead or injured and without sufficient food. The koala rescue team’s work is to inspect the reserves and provide help to the koalas. Unfortunately, the team operates within a restricted budget and sometimes has to make difficult decisions. The aim of the rescue team is to save as many koalas as possible within a limited budget.

The koala reserve consists of a series of observation points where the rescue team pauses, observes the koala population, the trees, and the predators, and decides how the koalas can be helped. The help may be to move a koala to a safe haven if it is injured or there is not enough food or shelter.

Koala Rescue Team simulation

The Koala Rescue Team simulation begins with a welcome message and an invitation to the rescue team leader to enter his/her name. The name cannot be blank but must be less than 16 alphabetic characters. The leader is then asked to enter the budget for the rescue. This is an amount from $100 to $200, inclusive.

The program then sets up the numbers of trees, koalas and predators in each of the 10 observation points as follows:

  1. The numbers of trees in the reserve are read from a text file trees.txt. The numbers of each type of tree (Manna Gum, Swamp Gum, Blue Gum, River Red Gum, Wattle) at each observation point are read in from the file. The file has 10 lines, with 5 comma separated numbers on each line. Each line represents the tree numbers at each observation point. There is no other reading from the file during the actual running of the program.

Each tree is either used for shelter or food. Each shelter tree can hold a maximum of one koala. The food trees can produce a certain weight of leaves per day that can be eaten by the koalas (see Table 1). The weight is used to calculate the total food available for the koalas at any observation point. The food available is calculated by multiplying the number of each tree type by the weight of leaves it produces and summing these to get the total food available. Each koala, whether healthy or injured, can eat 1 kg of leaves per day

Type of tree Usage Kg of edible leaves per day 1.00 Manna Gum Food Food 0.34 Food 0.90 Swamp Gum Blue Gum River Red Gum Wattl

  1. There is a random number of koalas at each observation point as follows:

• 0-9 healthy koalas.

• 0-2 injured koalas.

Each koala will have a randomly allocated age of 1-18 years.

  1. There is a random number of 0-4 predators at each observation point.

  2. There are no koalas in safe haven at the start of the rescue.

The rescue team visits each of 10 observation points in turn. At each observation point the rescue team considers the number of trees, the number and condition of the koalas (some of which may be injured) and the number of predators. The team takes actions to help the koalas at each point. If the budget runs out at any point then the rescue mission continues but no actions can be taken that involve cost. The rescue mission is considered successful when all areas have been observed and all koalas have survived

Specific observation point actions

At each observation point the following actions are performed

  1. The trees are assessed for damage. For each type of tree there is 5% chance that one tree of that type has been burnt or has fallen over. If this happens then the number of trees at the observation point is updated. Note this must happen before the available food and shelter are calculated. (Hint: to calculate a probability of 5% generate a random number from 1 to 20. There will be a 5% chance of any of these numbers being generated. So, you can nominate one number, say 20, and test for that to give you the 5%).

  2. The program then displays the status of the observation point and available budget as follows:

• the number of injured koalas

• the number of healthy koalas

• the weight of available food (Each koala eats 1 kg of leaves per day, whether healthy or injured).

• the number of shelter trees

• the number of predators

• the available budget

  1. The rescue team assesses the situation and decides what actions to take to aid the koalas’ survival within the available budget. Note that if the rescue budget runs out at any stage then no further actions can be carried out that involve a cost.

The following menu options are displayed:

A. Move an injured koala to the safe haven – an injured koala can be sent to the safe haven where it can be treated. If an injured koala is not taken to the safe haven then it does not survive. The cost of moving each injured koala is $20.

B. Move a healthy koala to the safe haven – if there is a shortage of food or shelter then a koala is sent to the safe haven to await possible relocation. The cost of moving each healthy koala is $10.

C. Relocate a koala to this location – a koala is relocated to this location from the safe haven. The oldest healthy koala in the safe haven is chosen each time. Note that koalas can only be relocated to a location where there is enough food, enough shelter, and fewer than three predators. For each koala relocated, $5 is added to the rescue budget.

D. Take no further action – rescue actions have finished.

After each action is taken the status of the observation point and available budget is redisplayed. The team can take as many actions as they decide.

  1. When the team decides to take no further action, the survival (or not) of the koalas is determined and the numbers of koalas updated. There are several possibilities:

a. Injured koalas not taken to the safe haven do not survive.

b. Shortage of food: Each koala in excess of the number that can be sustained by the available food supply has an 80% chance of not surviving.

c. Lack of shelter: Each koala in excess of the number that can be sheltered by the available trees has a 20% chance of not surviving.

d. Predators: If there are more than three predators then there is a 50% chance of one koala in the population being killed by a predator.

Note that the numbers of koalas must be adjusted after each assessment. For example, if there is a koala who does not survive because of the food shortage then there is one less koala to consider for the shelter. Finally, if there are more than three predators then there is a 50% chance of a koala being killed by a predator.

  1. When the rescue team finishes their work the following information about the observation point is displayed to the screen. The totals of:

• koala deaths (the total of injured koalas who were not taken to the safe haven, koalas who did not survive a food shortage or lack of shelter, and koalas killed by predators, as determined from the scenarios above)

• amount remaining in the budget

Specific actions at the completion of the observations

After all the observation points have been visited then the following summary totals are displayed on the screen:

• number of trees that have been lost

. • healthy koalas (both in the reserve and safe haven)

• injured koalas taken to the safe haven

• koalas relocated

• amount spent on the rescue

  1. Finally, the last line of the summary should include the statement “Rescue was successful, with no koala deaths” or "Rescue completed with ‘n’ koalas deaths”.

  2. The updated totals of trees are written back to the file updatedTrees.txt.

Class Design

Your program must consist of at least seven classes. A suggested class design is shown in Figure 1. You may want to include comments in your program to state any assumption made.!