Question
Hello, I have another code lab question I need help with. Again, if you can make it easyh to understand, that would be great, thanks!!!
Hello, I have another code lab question I need help with. Again, if you can make it easyh to understand, that would be great, thanks!!!
5.11: Population Write a program that will predict the size of a population of organisms. The program should ask the user for the starting number of organisms, their average daily population increase (as a percentage, expressed as a fraction in decimal form: for example 0.052 would mean a 5.2% increase each day), and the number of days they will multiply. A loop should display the size of the population for each day.
Input Validation.Do not accept a number less than 2 for the starting size of the population. If the user fails to satisfy this print a line with thismessage "The starting number of organisms must be at least 2.", display the prompt again and try to read the value . Similarly, do not accept a negative number for average daily population increase , using the message "The average daily population increase must be a positive value ." and retrying. Finally, do not accept a number less than 1 for the number of days they will multiply and use the message "The number of days must be at least 1."
Instructor Notes:
Here are all of the necessary output strings to assist you with this assignment.
"Enter the starting number of organisms: " "The starting number of organisms must be at least 2. " "Enter the average daily population increase (as a percentage): " "The average daily population increase must be a positive value. " "Enter the number of days they will multiply: " "The number of days must be at least 1. " "On day " " the population size was "
SAMPLE RUN #1: ./ETest Enterthestartingnumberoforganisms:20 Entertheaveragedailypopulationincrease(asapercentage):0.1 Enterthenumberofdaystheywillmultiply:10 Onday1thepopulationsizewas22. Onday2thepopulationsizewas24. Onday3thepopulationsizewas27. Onday4thepopulationsizewas29. Onday5thepopulationsizewas32. Onday6thepopulationsizewas35. Onday7thepopulationsizewas39. Onday8thepopulationsizewas43. Onday9thepopulationsizewas47. Onday10thepopulationsizewas52.
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