Rewrite the pond life program from Figure 13.10 so that the values declared at the start of
Question:
Rewrite the pond life program from Figure 13.10 so that the values declared at the start of the program are no longer constant. The program’s user should be able to enter values for all of these constants. Also, improve the program so that the fish are more realistic. In particular, the fish should be born at a small size and grow to some maximum size. Each fish should also have a weekly food requirement that is proportional to its current size.
Transcribed Image Text:
FIGURE 13.10 The Pond Life Simulation Java Application Program // FILE: PondLife.java // A simple simulation program to model the fish and weeds in a pond import edu.colorado.simulations.*; // Provides Organism, Plant, Herbivore classes import java.util.Vector; public class PondLife { // Number of weeds in the pond public static final int MANY_WEEDS = 2000; // Initial size of each weed, in ounces public static final double WEED_SIZE = 15; // Growth rate of weeds, in ounces/week public static final double WEED_RATE 2.5; // Initial number of fish in the pond public static final int INIT_FISH = 300; // Fish size, in ounces public static final double FISH_SIZE = 50; // A fish must eat FRACTION times its size during one week, or it will die. public static final double FRACTION = 0.5; // Average number of weeds nibbled by a fish over a week public static final int AVERAGE_NIBBLES = 30; // At the end of each week, some fish have babies. The total number of new fish born is the // current number of fish times the BIRTH_RATE (rounded down to an integer). public static final double BIRTH_RATE = 0.05; // Number of weeks to simulate public static final int MANY_WEEKS 38;
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 62% (8 reviews)
ANSWER Heres the rewritten program with user input for the initial values and with fish that grow and have a weekly food requirement proportional to their current size import javautilScanner import ja...View the full answer
Answered By
Aketch Cindy Sunday
I am a certified tutor with over two years of experience tutoring . I have a passion for helping students learn and grow, and I firmly believe that every student has the potential to be successful. I have a wide range of experience working with students of all ages and abilities, and I am confident that I can help students succeed in school.
I have experience working with students who have a wide range of abilities. I have also worked with gifted and talented students, and I am familiar with a variety of enrichment and acceleration strategies.
I am a patient and supportive tutor who is dedicated to helping my students reach their full potential. Thank you for your time and consideration.
0.00
0 Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
For this project you are tasked with building a user application that will select sets of random numbers. Your application must use functions and pass values. Your program will pick sets of 6 random...
-
Sunshine Motors is a large car dealership with 5 branches spread over the Melbourne Metropolitan area, with the Head Office located in Sunshine, the west of Melbourne. David Da Costa is the CEO of...
-
For your capstone project, you will implement a simple Character Creation Screen as found in many different RPGS (role playing games.) This screen will allow the user to pick and save a character's...
-
. The electric polarization P of a light wave for high values of the electric field E is given by: P= a(c,E+cE + cE) where a, c1, c2 and c3 are constants. Find the expression for the instantaneous...
-
The Ottawa Citizen reports that a pro-choice rally was attended by 8725 people. Comment.
-
For each triangle, find the measure of the labeled angle or the length of the labeled side. a. b. c. d. e. f. 28 16 31 15 19 12
-
Why is the Industrial Revolution significant for managers?
-
Cambridge, Inc., is considering the introduction of a new calculator with the following price and cost characteristics: Sales price . . . . . . . . . . . . . $ 18 each Variable costs . . . . . . . ....
-
In 2009 Stanley made hip withdrawal that total $18,000 in what year must Stanley begin making payments and what is the latest date by which he can make his first repayment? Repayments must begin in...
-
Hill-O-Beans Coffee Company blends four component beans into three final blends of coffee: one is sold to luxury hotels, another to restaurants, and the third to supermarkets for store label brands....
-
A set is like a bag, except that a set does not allow multiple copies of any element. If you try to insert a new copy of an item that is already present in a set, then the set simply remains...
-
Rewrite the pond life program from Figure 13.10 so that the output is presented as a graph in an applet window. The applet can use most of the same graphing techniques as the fractal applet from page...
-
Find two positive numbers such that the sum of twice the first number and three times the second number is 216 and the product is a mzaximum.
-
Normally we rely on governments to produce key economic statistics. But what if you cant trust the governments numbers? Thats what happened in Argentina from 2007 to 2016, where it was common...
-
The CARES Act was the largest in both nominal and real measures of fiscal relief/stimulus passed in U.S. history. The package will cost more than $2 trillion as it stabilizes consumer spending during...
-
What accounting issues arise for the lessee in accounting for leases?
-
The country of Boldovia has no unemployment insurance benefits and a tax system using only lump-sum taxes. The neighboring country of Moldovia has generous unemployment benefits and a tax system in...
-
Moving is the worst. Yard work is the worst. Building IKEA furniture is the worst. So began a 2015 report on TaskRabbit, a company founded in 2008 (under the name RunMyErrand), that helps people hire...
-
Prove or disprove: If m, n are positive integers and m, n are perfect squares, then m + n is a perfect square.
-
Dan and Diana file a joint return. Dan earned $31,000 during the year before losing his job. Diana received Social Security benefits of $5,000. a. Determine the taxable portion of the Social Security...
-
What are some potential efficiency disadvantages of having very deep inheritance trees, that is, a large set of classes, A, B, C, and so on, such that B extends A, C extends B, D extends C, etc.?
-
What are some potential efficiency disadvantages of having very shallow inheritance trees, that is, a large set of classes, A, B, C, and so on, such that all of these classes extend a single class, Z?
-
Consider the following code fragment, taken from some package:
-
Here is a bivariate data set. x y. 61 92 72 192 53 -28 55 53 47 -7 58 48 78 198 Find the correlation coefficient and report it accurate to four decimal places. r =
-
Explain what the "so-called corporate veil" is and what is meant by lifting the veil in common law? B) Critically discuss the circumstances when the corporate veil can be lifted by the court.
-
In what ways do power structures and systems of privilege and oppression influence the trajectory of social change movements, and how can intersectional approaches address the complexities of...
Study smarter with the SolutionInn App