1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AnnZ [28]
2 years ago
11

Find the maximum value and minimum value in below mention code. Assign the maximum value to maxMiles, and the minimum value to m

inMiles. Sample output for the given program:
Min miles: -10
Max miles: 40
Here's what I have so far:

import java.util.Scanner;

public class ArraysKeyValue {
public static void main (String [] args) {
final int NUM_ROWS = 2;
final int NUM_COLS = 2;
int [][] milesTracker = new int[NUM_ROWS][NUM_COLS];
int i = 0;
int j = 0;
int maxMiles = 0; // Assign with first element in milesTracker before loop
int minMiles = 0; // Assign with first element in milesTracker before loop

milesTracker[0][0] = -10;
milesTracker[0][1] = 20;
milesTracker[1][0] = 30;
milesTracker[1][1] = 40;

//edit from here

for(i = 0; i < NUM_ROWS; ++i){
for(j = 0; j < NUM_COLS; ++j){
if(milesTracker[i][j] > maxMiles){
maxMiles = milesTracker[i][j];
}
}
}
for(i = 0; i < NUM_ROWS; ++i){
for(j = 0; j < NUM_COLS; ++j){
if(milesTracker[i][j] < minMiles){
minMiles = milesTracker[i][j];
}
}
}

//edit to here


System.out.println("Min miles: " + minMiles);
System.out.println("Max miles: " + maxMiles);
}
Computers and Technology
1 answer:
Kobotan [32]2 years ago
3 0

Answer:

Code works perfectly

Explanation:

There is nothing wrong with your program as it runs perfectly and displays the expected results.

You may need to compile with another compiler if you're not getting the required results.

I've added the source code as an attachment (unedited)

Download java
You might be interested in
Match the elements of a web page with their descriptions?
enyata [817]
The last one is audio, the third one is animation and the first one is graphics so
5 0
2 years ago
Read 2 more answers
Which features would work well for text entered into cells? Check all that apply.
yKpoI14uk [10]

Which features would work well for text entered into cells?

All the features given apply to text entered into a cell.

thesaurus , spelling , autosum , average , find , replace​

Explanation:

  • The tasks are referred to as basic tasks and include such operations as inserting and typing over, copying and moving items, finding and replacing text, undoing and redoing commands, checking spelling and grammar, using the thesaurus, and using formatting tools.
  • A thesaurus is used on a computer while writing an e-mail, letter, or paper to find an alternative meaning for words. For example, repeating the same word throughout your writing can become repetitive to a reader, and you could use a thesaurus to get a synonym of the word
  • Spelling is defined as the proper way to write a word, using the correct order of letters. This feature is provided by Excel for the cells.
  • AutoSum is a Microsoft Excel and other spreadsheet program function that adds together a range of cells and displays the total in the cell below the selected range.
  • The AVERAGE function calculates the average of numbers provided as arguments. To calculate the average, Excel adds the numbers together and divides by the total number of values supplied.
  • The
  • Microsoft Excel FIND function returns the location of a substring in a string. The search is case-sensitive. The FIND function is a built-in function in Excel that is categorized as a String/Text Function.
  • The Microsoft Excel REPLACE function replaces a sequence of characters in a string with another set of characters. The REPLACE function is a built-in function in Excel that is categorized as a String/Text Function. It can be used as a worksheet function (WS) in Excel.
4 0
3 years ago
Read 2 more answers
I need help thanks please!
maw [93]

Answer:

a) to persuade

she is doing this to propose an idea to the boss of the company

6 0
3 years ago
Read 2 more answers
Is greedy algorithm non deterministic by nature?
Flura [38]

Answer: Yes

Explanation: Greedy algorithm is the algorithm that gives the solution to the problem on the basis of the piece by piece or step by step architecture.  the next step of the solution is based on the aim of solving problem optimally.But the steps chosen can be correct or incorrect.

Non-deterministic nature is the feature that determines that the  steps that is being chosen is not the most optimal one and no high surety is present.Thus, this nature is present in the greedy algorithm and it has non-deterministic nature.

7 0
3 years ago
How can you different between standard and protocol?
Verizon [17]
A standard is something that is always at a certain time of the day and is scheduled the same. A protocol takes priority of anything and everything else you work on.
6 0
2 years ago
Other questions:
  • ____________________ is the premeditated, politically motivated attacks against information, computer systems, computer programs
    6·2 answers
  • A user states that when they power on their computer, they receive a "Non-bootable drive" error. The user works with external st
    8·1 answer
  • What color does Sam obtain when he mixes white with a color? Sam is painting a landscape and needs to paint the sky light blue.
    9·2 answers
  • How can volunteering yo help plan fundraiser for your team or club be a way to develop your strengths?
    13·1 answer
  • (2) Design pseudocode for a program that accepts numbers from the user until the special number 555 is entered (you should use a
    12·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    15·2 answers
  • Ok so this question is kinda weird but does anyone know what google drive is. If so how do you upload a video to it?
    11·2 answers
  • Create a method called letterGrade that will pass the student's average grade as a parameter and return a letter grade (char). O
    12·1 answer
  • The symbol located to the left of a code number that identifies a code description that has been revised is _____.
    12·1 answer
  • What skills did Carl work on, and what steps did he take to reach his long term goals?<br>​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!