Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

) You have been asked by Saudi Wildlife Authority to design a class named Species to manage dangered species. Class details are as following: -

image text in transcribed

) You have been asked by Saudi Wildlife Authority to design a class named Species to manage dangered species. Class details are as following: - Three data fields (properties) which are: - name of type String which stores name of species, - population of type int which stores the current population of the species and it can not be negative, and - growthRate of type double which stores the growth rate of the current population. - A method readinput() that reads the values of data members. The method must not allow the user to enter incorrect population value. If this happens, it should keep asking for correct value until the user enters it. - A method writeOutput() that prints the data of the species. - A method predictPopulation(int years) that returns the projected population of the species after the specified number of years (which must be a non-negative number). - A method setSpecies(String newName, int newPopulation, double newGrowthRate) that sets values of receiving object to new data sent through parameters. The method should print an error message if newpopulation is a negative number. - Getter methods for name, population and growthRate. Draw the UML diagram for the class and then implement the class. Write a test program that : 1. Declare object s of the class Species 2. Reads the information of some species X. 3. Stores the information in s only after making sure population is not negative. 4. Ask the user to enter number of years to predict population 5. Print the species population after the years given above. 6. Repeat step 4 and 5 until the user enters 1 as number of years. Name your classes Species and TestSpecies. Use two separate files for each of the two classes. mple Run lat is the species' name? Arabian Tiger lat is the population of the species? 200 ter growth rate (\% increase per year): 3 ter how many years? 100 e population of the Arabian Tiger after 100 years is 3843 ter how many years? 110 e population of the Arabian Tiger after 110 years is 5165 ter how many years? - 1 odbye

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

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions

Question

What stereoisomer of A also gives compound C on heating?

Answered: 1 week ago

Question

Explain in brief the functions and functioning of stock exchanges.

Answered: 1 week ago

Question

Solve equation: (AUX)B=AUBX

Answered: 1 week ago

Question

explain the need for human resource strategies in organisations

Answered: 1 week ago

Question

describe the stages involved in human resource planning

Answered: 1 week ago