Question
I need this in Java language. You have been hired by the Everglades National Park to develop a program that will estimate how many eggs
I need this in Java language.
You have been hired by the Everglades National Park to develop a program that will estimate how many eggs a female python will lay over the course of a lifetime. The user will be asked to enter the age of the python, and you should validate the age with a while loop to ensure that the age falls between 1 and 20. You will calculate how many years that the python is expected to breed using an estimate of 20 years as the average lifetime of the python and a breeding age beginning at 4 years. If you process a python that is 4 years old or less, the output should show results for year 4 to year 20 meaning that even if the python is 2 years old, your results will count only from 4 to 20 years of age. If the python is more than 4 years old, the output should show results for the python from its current age forward to its 20" year meaning that if the python is 10, the output will count from year 10 to year 20. A while or for loop must be used to calculate and display the sum of the eggs that the python will lay each year during the breeding lifecycle and sum of all eggs that the python has laid as of the end of each year. You must also sum the eggs for all pythons processed and display that sum after the program ends.
Below is the output for the program when running with test data. Input data is shown in red and italicized.
This is the Python Snake Eggstimator Program.
It estimates the number of eggs that a female python will produce over a lifetime. Please enter HISS if you want run the program or STOP to quit.
Please enter HISS if you want run the program or STOP to quit.
hiss
Enter the Python ID:
notmyfault3
Enter the age of the python in years:
Year | Previous Year Eggs Current Year | Eggs | Sum of all Eggs |
10 | 0 | 35 | 35 |
11 | 35 | 35 | 70 |
12 | 70 | 35 | 105 |
13 | 105 | 35 | 140 |
14 | 140 | 35 | 175 |
15 | 175 | 35 | 210 |
16 | 210 | 35 | 245 |
17 | 245 | 35 | 280 |
18 | 280 | 35 | 315 |
19 | 315 | 35 | 350 |
20 | 350 | 35 | 385 |
notmyfault3 will lay a total of 385 eggs over her remaining lifetime of 20 years.
Please enter HISS if you want run the program or STOP to quit. The sum of all eggs for all Pythons processed is 1,540
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