Question: SA - 1 This assignment is based on a true story. Commercial fisherman John Alderidge fell overboard from a moving boat miles from shore and
SA
This assignment is based on a true story. Commercial fisherman John Alderidge fell overboard from a moving boat miles from shore and his crew mates did not notice his absence until hours later. The Coast Guard initiated a search immediately after learning about the incident, but the odds of finding John were small he was a small speck in large ocean. In this assignment you will help the Coast Guard optimize the search.
While no one knew exactly when John went overboard, the Coast Guard did know the boats course and could estimate how John would drift in the ocean currents. This meant John was more likely to be in some parts of the ocean than others. The Coast Guard created a virtual grid over the ocean and estimated the probability John would be in any particular row col grid square. The diagram below shows an example of a row by column grid where darker colors indicate locations more likely to contain John, lighter colors represent locations less likely to contain John. The Coast Guard wants to send helicopters to search the most likely locations first.
Exercises
Create a SearchAndRescue class that uses a twodimensional array to represent an m row by n column grid. Your constructor should take m and n as parameters and store them in addition to creating and storing the grid array. Each grid location holds the Coast Guards estimate of the probability a number between and that John is in that particular square. Initialize each grid square to total number of grid squares eg each grid square is initially equally likely to contain John
Complete the following method for your SearchAndRescue class that allows the Coast Guard to update their estimate of the probability John is located in a row col grid location. Assume the Coast Guard will initially call this method many times to set their initial estimate of where John is likely located. Print an error message if row or col are invalid. Also print an error message if the probability is invalid.
public void setGridProbabilityint row, int col, double probability
Write a method for your SearchAndRescue class called bestLocation that prints the xy location most likely to contain John so the Coast Guard can vector helicopters to search for him there. If multiple locations tie for the highest probability, choose one of them however you see fit.
I recommend begining this class from scratch, but you may use SearchAndRescue.java as a starter if you'd like. NOTE: the scaffold contains a main method with some test cases and a toString method for printing the grid.
SA provided code
Creates a search grid for a lost fisherman, where each row,col grid l
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
