Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need the Java program code for this please help. Can you please also add small comments when doing each step please thank you You

I need the Java program code for this please help. Can you please also add small comments when doing each step please thank you

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.

hiss

Enter the Python ID:

lwishlwereNBurma

Enter the age of the python in years: Invalid Age: Please enter an age between 1 and 20. 21

Invalid Age: Please enter an age between 1 and 20.

Year

Previous Year Eggs

Current Year Eggs

Sum of all Eggs

4

0

35

35

5

35

35

70

6

70

35

105

7

105

35

140

8

140

35

175

9

175

35

210

10

210

35

245

11

245

35

280

12

280

35

315

13

315

35

350

14

350

35

385

15

385

35

420

16

420

35

455

17

455

35

490

18

490

35

525

19

525

35

560

20

560

35

595

lwishlwereNBurma will lay a total of 595 eggs over her remaining lifetime of 20 years.

Please enter HISS if you want run the program or STOP to quit. hiss

image text in transcribedPlease 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions