Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.Scanner; public class project4{ public static void main (String[]args){ Error message double can not be converted to boolean. how to fix it? Scanner input

import java.util.Scanner;

public class project4{

public static void main (String[]args){

Error message double can not be converted to boolean. how to fix it?

Scanner input = new Scanner (System.in);

System.out.println("Enter the number of Rows:");

int row = input.nextInt();

System.out.println("Enter the number of Columns:");

int column = input.nextInt();

double[][] a = new double [row][column];

System.out.println("Enter the array:");

for (int i=0; i

for (int j=0; j

a [i][j] = input.nextDouble();

}

}

Location location = locateLargest(a);

System.out.println("The location of the largest element is" + location.maxValue + "at(" + location.row +"," + location.column + ")");

}

public static Location locateLargest (double[][]a){

Location location = new Location();

location.maxValue = a[0][0];

location.row = 0;

location.column= 0;

for(int i=0; i

for(int j=0; j

if( location.maxValue = a[i][j]){

location.Maxvalue = a[i][j];

location.row =i;

location.column=j;

}

}

return location;

}

}

class Location{

int row,column;

double maxValue;

}

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 Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

1. Explain the 2nd world war. 2. Who is the father of history?

Answered: 1 week ago