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
MakcuM [25]
3 years ago
6

Find the maximum value and minimum value in milesTracker. Assign the maximum value to maxMiles, and the minimum value to minMile

s. 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:
Ann [662]3 years ago
7 0

Answer:

See Explanation

Explanation:

Your program is correct and doesn't need an attachment.

However, there's a mismatch in placement of curly braces in your program

{

}

I've made corrections to that and I've added the corrected program as an attachment.

Aside that, there's no other thing to be corrected in your program.

Use another compiler to compile your program is you are not getting the required output.

Download java
You might be interested in
In Microsoft Word you can access the _______ command from the "Mini toolbar".
xenn [34]
I think the answer is save as
4 0
4 years ago
Look at the four schematic symbols shown in the figure above. Each of the symbols is labeled with a number. Which of the followi
ladessa [460]
The correct answer for the question that is being presented above is this one: "D. Symbol 1 represents a transistor, symbol 2 represents a diode, symbol 3 represents a resistor, and symbol 4 represents a lightbulb." <span>Each of the symbols is labeled with a number. </span>
6 0
4 years ago
Sydney Bark is twenty-three years old, and is looking forward to celebrating her birthday on April 12. For her birthday, she sav
DochEvi [55]

Answer:

a future date

Explanation:

Because most people when trying to guess a password, start with basic ones like: 1234,abcde, password,l and dates (like their birthday). whereas, the person would never guess it was a future date like when the person would be 30 or when they are going on a trip .

5 0
3 years ago
Write a Python function isPrime(number) that determines if the integer argument number is prime or not. The function will return
pickupchik [31]

Answer:

def test_prime(n):

   if (n==1):

       return False

   elif (n==2):

       return True;

   else:

       for x in range(2,n):

           if(n % x==0):

               return False

       return True              

print(test_prime(9))

3 0
3 years ago
Consider the following base and derived class declarations: class BaseClass { public: void BaseAlpha(); private: void BaseBeta()
Alina [70]

Answer:

a) Baseclass - baseField

DerivedClass - derivedField

b) BaseClass - baseField

DerivedClass - derivedField

c) BaseClass - BaseBeta(), BaseAlpha()

DerivedClass - BaseAlpha(), DerivedAlpha(), DerivedBeta()

d) BaseClass - BaseAlpha()

DerivedClass - BaseAlpha(), DerivedAlpha(), DerivedBeta()

Explanation:

a) Since, private members of a class cannot be inherited, that is why, DerivedClass has only one private data member.

b) Member function of a class can invoke private data variables of the class, so, they can refer to their private members on their own but DerivedClass has no access to BaseClass's private members.  

c) Every member function of a class can invoke every other member function of that class, but DerivedClass's member function cannot invoke BaseClass's private member functions.

d) Object of a class has no access to private members of a class, that is why they can invoke only public member functions of the class.

8 0
3 years ago
Other questions:
  • "what is the #1 resource used when researching a product online?"
    5·1 answer
  • In the following code, what is the first line that introduces a memory leak into the program?
    6·1 answer
  • Cellular digestion associated by what organelles?​
    5·2 answers
  • Hi Alaza, when you submit this form, the owner will be able to see
    12·1 answer
  • What is modularity? Help asap
    9·1 answer
  • And tags are examples of stand - alone tags.
    15·1 answer
  • Suppose end system A wants to send a large file to end system B. At a very high level, describe how end system A creates packets
    9·1 answer
  • You're as smooth as Tennessee whiskey
    8·2 answers
  • 1. Encrypt this binary string into cipher text: 110000. Include in your answer the formula the
    10·1 answer
  • Which UPPER function is written so that all text in cell B4 will be capitalized? O=UPPER(B4) O=UPPER[B4] O UPPER B4 O=UPPER
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!