Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need a help to complete the greedy lowest-elevation code, 2D arry must be read from a file. not by using Scanner import java.util.*; import

I need a help to complete the greedy lowest-elevation code, 2D arry must be read from a file. not by using Scanner

import java.util.*; import java.io.*; import java.awt.*;

public class MapDataDrawer {

private int[][] grid;

public MapDataDrawer(String filename, int rows, int cols){ // initialize grid //read the data from the file into the grid } /** * @return the min value in the entire grid */ public int findMinValue(){ return -1; } /** * @return the max value in the entire grid */ public int findMaxValue(){ return -1; } /** * @param col the column of the grid to check * @return the index of the row with the lowest value in the given col for the grid */ public int indexOfMinInCol(int col){ return -1; } /** * Draws the grid using the given Graphics object. * Colors should be grayscale values 0-255, scaled based on min/max values in grid */ public void drawMap(Graphics g){ }

/** * Find a path from West-to-East starting at given row. * Choose a foward step out of 3 possible forward locations, using greedy method described in assignment. * @return the total change in elevation traveled from West-to-East */ public int drawLowestElevPath(Graphics g, int row){ return -1; } /** * @return the index of the starting row for the lowest-elevation-change path in the entire grid. */ public int indexOfLowestElevPath(Graphics g){ return -1; } }

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_2

Step: 3

blur-text-image_3

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

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions