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
Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255
Effectus [21]

Answer:

<em>The programming language is not stated; However, I'll answer the question using C++ programming language, </em>

<em>This program uses comments for explanations  </em>

<em>Program starts here</em>

#include<iostream>

using namespace std;

int main()

{

//Declare Array

int colorcode[3],graycode[3];

//Prompt user for color code

cout<<"Enter Color Code (One on a line)"<<endl<<"Inout Range is 0 to 255"<<endl;

for(int i = 0;i<3;i++)

{

 ccode:  

 cout<<"Enter Color Code "<<i+1<<": ";

 cin>>colorcode[i];

 if(colorcode[i]<0 || colorcode[i]>255)

 {

  cout<<"Input Range is 0 to 255"<<'\n';

  goto ccode;

 }

}

//Initialize smallest to colorcode[0]

int smallest = colorcode[0];

//Determine smallest

for(int i = 0;i<3;i++)

{

 if(colorcode[i]<smallest)

 {

  smallest = colorcode[i];

 }

}

//Determine Graycode

for(int i = 0;i<3;i++)

{

 graycode[i] = colorcode[i] - smallest;

}

//Display Result:

cout<<"Color Code: "<<"(";

for(int i = 0;i<3;i++)

{

 if(i!=2)

 {

 cout<<colorcode[i]<<",";  

 }

 else

 {

  cout<<colorcode[i]<<")"<<endl;  

 }  

}

cout<<"Gray Code: "<<"(";

for(int i = 0;i<3;i++)

{

 if(i!=2)

 {

 cout<<graycode[i]<<",";  

 }

 else

 {

  cout<<graycode[i]<<")"<<endl;  

 }  

}

return 0;

}

8 0
3 years ago
Which of the following is a proper use of the application NetStumbler?Which of the following is a proper use of the application
Eddi Din [679]

Answer:

Finding rogue access points within your network

Explanation:

A

5 0
4 years ago
Read 2 more answers
how such a company can improve the focus and relationship with customers, and what they will benefit from this improvement.
aalyn [17]
They can work and talk with customers and see what customers want and tailor to some of the customers need. Ask for feed back and reviews and customers will be more likely to shop again if they feel the business cares what they think.
7 0
4 years ago
the two main ways in which marketers address the competition with their strategies are by satisfying a need better than a compet
Nonamiya [84]

Offering a lower price (Apex)

4 0
3 years ago
Read 2 more answers
Lenders always accept applications for credit
LenKa [72]
The correct answer to the question that is being stated above is FALSE.

The statement is false because lenders do not always accept applications for credit. Lenders always consider credit history of the applicant. If the applicant has a good credit history background, then he qualifies.
3 0
3 years ago
Other questions:
  • Why is it important to begin development of a software solution with a programming design in place? A programming design summari
    6·1 answer
  • His function starts a new session.
    12·1 answer
  • WILL MARK BRAINLIEST IF ANSWERED ASAP
    10·1 answer
  • Which of the following courses would an aspiring film composer most likely take?
    12·2 answers
  • Maria found a cupcake recipe on a cooking blog. However, she would like to read comments and suggestions before she begins bakin
    6·2 answers
  • Which is a type of display monitor? HDD CPU SSD LCD
    6·1 answer
  • When aJSP page is compiled, what is it turned into?AppletServletApplicationMidlet
    14·1 answer
  • PLEASE HELP ILL GIVE BRAINIEST
    6·2 answers
  • Reality and computer-generated simulations can solve a lot of problems
    14·1 answer
  • Which term refers to a shorthand method for identifying network and host bits in an ip address?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!