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: 50% (10 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.
-
Kelly is self-employed and incurs $2,200 of business meal expense in connection in with business travel. $500 of the business meal cost are considered to be lavish or extravagant. How much can Kelly...
-
Describe some practical physical limitations on the use of the RRIM process in molding of chopped FRP matrix composites.
-
An airline makes 200 reservations for a flight that holds 185 passengers. The probability that a passenger arrives for the flight is 0.9 and the passengers are assumed to be independent. (a)...
-
A ball is thrown vertically, from a height h=24.7m, with velocity vi. It lands on the ground after a time interval t. Coordinate axes are indicated in the figure. Assume that air resistance is...
-
Bachinos Pizzas accounts follow. The company has just completed its first year of operations ended September 30, 2014. Accounts Payable.......... $ 21,000 Accounts Receivable........... 26,400...
-
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...
-
Calculate the pH of a 0.072 M aqueous solution of aluminum chloride, AlCl3. The acid ionization of hydrated aluminum ion is Al(H 2 O) 6 3+ (aq) + H 2 O(l) Al(H 2 O)5OH 2+ (aq) + H 3 O + (aq) and K a...
-
The following output (from \(\mathrm{R}\) ) is for a multiple regression. Something went wrong with the printer, so some of the numbers are missing. Fill in the missing numbers. Coefficients:...
-
True or False? The implicit representation of a set uses the list ADT.
-
Refer to the data set pit.csv. Consider depths of pits at all durations at \(40 \%\) relative humidity. The question is whether the mean depth differs among the durations. a. Construct an ANOVA...
-
Rewrite Exercise 5, making MergeLists a linked member function of the Sorted List ADT. Exercise 5 Rewrite Exercise 4, making MergeLists an array-based member function of the Sorted List ADT. Exercise...
-
A merge sort is used to sort an array of 1,000 test scores in descending order. Which of the following statements is true? 1. The sort is fastest if the original test scores are sorted from smallest...
-
Janice Morgan, age 24, is single and has no dependents. She is a freelance writer. In January 2015, Janice opened her own office located at 2751 Waldham Road, Pleasant Hill, NM 88135. She called her...
-
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:
-
A one cubic foot sample of a borrow-source clay weighed 88 lbs. If the specific gravity of solids was measured as 2.70, and the clay was found to be 10 percent saturated, determine the water content...
-
Evaluate the use of novel catalytic systems, such as structured catalysts, catalytic distillation, and multifunctional catalysts, in achieving process intensification, discussing the effects on...
-
Find the minimum tractive effort required for vehicle to maintain 70mph speed at 5%upgrade through an air density of 0.002045 slug/ft^3. Show all steps and unit conversion please Problem 2:...
Study smarter with the SolutionInn App