Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q1. Solve P-2.22 on page 91 of the textbook. P-2.22 Write a Java program that inputs a document and then outputs a bar-chart plot of

image text in transcribed
image text in transcribed
Q1. Solve P-2.22 on page 91 of the textbook. P-2.22 Write a Java program that inputs a document and then outputs a bar-chart plot of the frequencies of each alphabet character that appears within that document. Hint: You don't have to use GUI constructs; simple text output is sufficient, say, using X's to indicate the values to print for each bar (and printing them sideways). Q2. Solve P-2.23 on page 91 of the textbook. P-2.23 Write a Java program to simulate an ecosystem containing two types of creatures, bears and fish. The ecosystem consists of a river, which is modeled as a relatively large array. Each cell of the array should contain an Animal object, which can be a Bear object, a Fish object, or null. In each time step, based on a random process, each animal either attempts to move into an adjacent array cell or stay where it is. If two animals of the same type are about to collide in the same cell, then they stay where they are, but they create a new instance of that type of animal, which is placed in a random empty (i.e., previously null) cell in the array. If a bear and a fish collide, however, then the fish dies (i.e., it disappears). Use actual object creation, via the new operator, to model the creation of new objects, and provide a visualization of the array after each time step

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

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions

Question

LO2 Compare three types of individual incentives.

Answered: 1 week ago