FIT9131 Semester 1 2020
FIT9131 XXXXXXXXXXSemester 1 2020
1 XXXXXXXXXX11/05/2020
Assignment 2
Koala Rescue
Introduction
This assignment is due by 10pm AEST Friday of Week XXXXXXXXXXJune, 2020).
This assignment is worth 25% of the marks for your final assessment in this unit. Heavy penalties
will apply for late submission. This is an individual assignment and must be your own work.
Please note the section on plagiarism in this document.
In preparing your assignment please note the following:
o The assignment must be done using the BlueJ environment.
o The Java source code for the assignment must be implemented according to the
FIT9131 Java Coding Standards.
o You must acknowledge all code in your assignment that you have taken from
other sources.
o Only a text interface is to be used for this program, there is to be no GUI. More
marks will be gained for a game that is easy to follow with clear information/e
or
messages.
Any points needing clarification may be discussed with your tutor in the lab classes. You should
not make any assumptions about the program without consulting your tutor.
Completion of this assignment contributes towards the following FIT9131 learning outcomes:
1. design, construct, test and document small computer programs using Java;
2. interpret and demonstrate software engineering principles of maintainability, readability, and
modularisation;
3. explain and apply the concepts of the "object-oriented" style of programming.
Specification
For this assignment you will simulate the work of a koala rescue team. This section specifies the
equired 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
estricted to a few varieties of gum trees (e.g., Manna Gum, Swamp Gum, Blue Gum, and River
https:
www.google.com.au/url?sa=i&url=https%3A%2F%2Funsplash.com%2Fs%2Fphotos%2Fkoala&psig=AOvVaw0S5kA9ceCvQxlFsw8JlJ3R&ust= XXXXXXXXXX&source=images&cd=vfe&ved=0CAIQjRxqFwoTCPi3m_rej-kCFQAAAAAdAAAAABAD
FIT9131 XXXXXXXXXXSemester 1 202 XXXXXXXXXXAssignment 2
________________________________________________________________________
2 XXXXXXXXXX11/05/2020
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
urnt 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
escue 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.
.
Table 1 Types of gum trees and weight in Kg of leaves that can be eaten by one koala per day
Type of tree Usage Kg of edible
leaves per day
Manna Gum Food 1.00
Swamp Gum Food 0.34
Blue Gum Food 0.90
River Red Gum Food 0.40
Wattle Shelter 0
2. 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.
FIT9131 XXXXXXXXXXSemester 1 202 XXXXXXXXXXAssignment 2
________________________________________________________________________
3 XXXXXXXXXX11/05/2020
3. There is a random number of 0-4 predators at each observation point.
4. 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
e 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
3. 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 ca
ied 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