Question
java code for this question Description :In this assignment you will analyze food webs. In order to do this you will need to load a
java code for this question
Description :In this assignment you will analyze food webs. In order to do this you will need to load a description of predator-prey relationships from a file, store them in a data structure, and identify the relationships between the organisms
Predator-Prey File Format
The predator prey information is stored in CSV (comma separated value) files. Each line in the file will be of the form ,,,..., where and are placeholders for specific animals. Each line will always begin with exactly one predator, followed by 1 or more prey. For example, lines in the file could be Whelk, Limpets, Mussels or Lion, Zebra. Note the predator and prey names may include a mixture of upper and lowercase letters, and may also include spaces. In order to make the files easier to work with you can assume that there will not be any spaces immediately before or after any of the commas.
Part 1: What do the Predators Eat?
Your first task is to list everything that each predator eats on a single line with nice formatting. For example, if your file contains the line: Lion,Gazelle,Wildebeest ,Zebra then you should output a single line for Lion that reads Lion eats Gazelle, Wildebeest and Zebra Notice that commas appear after all items except the last and second last items, and that the word and appears between the last and second last items. You will be graded on correctly following this layout, but I have provided a module that includes a function that will do the formatting for you all you need to do is import the function and call it. In order to complete this and subsequent tasks you must load all of the data from the food web file into a dictionary that describes the eats relationship. The keys in the dictionary will by the names of the predators. The values in the dictionary will be lists, where each element in the list is the name of a prey animal that the predator eats
Part 2: Identify the Apex Predators
We will define an apex predator to be any species in the food web that is not eaten by another organism. After displaying the predators and their prey your program should continue by displaying all of the apex predators with an appropriate heading. Hint: Apex predators are those animals that are keys in the dictionary that do not appear in any of the lists of animals eaten.
The output for Part 2 for AquaticFoodWeb.txt should be: Apex Predators: Bird, Fish and Lobster
Part 3: Identify the Producers
We will define a producer to be any species in the food web that does not eat another species. The output from your program should continue by displaying all of the producers with an appropriate heading.
The output for Part 3 for AquaticFoodWeb.txt should be: Producers: Phytoplankton and Seaweed
Part 4: Identify the Most Flexible Eaters
We will define the most flexible eater as the organism that eats the greatest number of other organisms in the food web. Identify and display all of the most flexible eaters under an appropriate heading. The most flexible eaters in the aquatic food web are: Most Flexible Eaters: Bird
Part 5: The Tastiest Organism
We will define the tastiest organism as the member of the food web that is eaten by the most different members of the food chain. Identify and display all of the tastiest organisms under an appropriate heading. The tastiest organisms in the aquatic food web are: Tastiest: Limpets and Mussels
note : 1)you have to use DATA STRUCTURES(graph)
2) you have to read data from a file like the photo bellow
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started