Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Language A zombie apocalypse has occurred, and everyone you know is turning into a zombie. You are stuck in a shopping mall with your

Java Language
A zombie apocalypse has occurred, and everyone you know is turning into a zombie. You are stuck in a
shopping mall with your family, and unfortunately, there is a zombie in the shopping mall. To save yourself
and your loved ones, you decided to analyze the zombies' movement and try to destroy them, and noticed
the following:
At any time, the zombie can move one step down or one step to the right (each step resembles a cell in nx
m grid, where n is number of rows, and m is number of columns)
One step rights
One step down
Luckily, you have an amount of venom. To kill the zombies, you hide portions of venom inside P pieces of
meat distributed randomly across the cells of the grid, where 1dotsVV(0,0)(0,0)(n-1,m-1)20,38,31,41,51,52,62,63,73,74,845,9,9,961P,(at most one piece per step) and the
amount of venom in a piece is randomly chosen from the range 1dotsV, where Vis the maximum amount of
venom that can be hidden in a piece of meat. The zombie is currently at cell (0,0) which is the upper left
corner of the grid. If the zombie collected the maximum amount of venom hidden in the pieces of meat in
the path from the upper left corner to the lower right corner, the zombie will die. Write a program that finds:
The maximum amount of the pieces that a zombie could collect to reach any target step in the grid
starting from step (0,0),as shown in the table sample output.
The sequence of steps that the zombie should visit to collect the maximum amount of the pieces
starting from step (0,0)to step (n-1,m-1).
InputOutput sample
Enter the number of rows: 10
Enter the number of columns: 7
Enter the number of meat pieces: 40
Enter the maximum amount of venom for a piece: 30
Sample Random Distribution of the meat pieces with their corresponding venom amounts:
Output Table:
Path Traversedt te0,18,20,38,31,41,51,52,62,63,73,74,84
,5,9,9,961
image text in transcribed

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

Database Publishing With Filemaker Pro On The Web

Authors: Maria Langer

1st Edition

0201696657, 978-0201696653

More Books

Students also viewed these Databases questions