Question: Java Description Write a program that will predict the size of a population of organisms. The program should ask for the starting number of organisms,
Java
Description Write a program that will predict the size of a population of organisms. The program should ask for the starting number of organisms, their average daily population increase (as a percentage), and the number of days they will multiply. For example, a population might begin with two organisms, have an average daily increase of 50%, and will be allowed to multiply for seven days. The program should use recursion to calculate and display the size of the population for each day. A recursive method is simply a method that calls itself, until a pre-specified condition is met. Input Validation: Do not accept a negative number for average daily population increase. Do not accept a number less than 1 for the number of days they will multiply. The Recursive Method function calculatePopulation(size: long, increase: double, days: long) if(days < 1) return else Print(Day: + days + + Size: + size) calculatePopulation((size * increase + size), increase, days-1) end function General Tips & Pointers Consider building this method into a standalone class. Dont forget to implement input validation. When making the recursive call in the else, it may be necessary to cast the first argument as a long. Days are printed in descending order (the highest valued day is the first); if you can figure out how to print the days in ascending order, that counts towards extra credit. Deliverables Submit a single pdf file in Canvas for grading. It should include pseudocode, a Unified Modeling Language (UML) class diagram, source code and test interaction output.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
