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
MAVERICK [17]
3 years ago
10

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: -10Max miles: 40#include using namespace std;int main( ) { const int NUM_ROWS = 2; const int NUM_COLS = 2; int milesTracker[NUM_ROWS][NUM_COLS]; int i = 0; int j = 0; int maxMiles = -99; // Assign with first element in milesTracker before loop int minMiles = -99; // Assign with first element in milesTracker before loop milesTracker[0][0] = -10; milesTracker[0][1] = 20; milesTracker[1][0] = 30; milesTracker[1][1] = 40; /* Your solution goes here */ cout << "Min miles: " << minMiles << endl; cout << "Max miles: " << maxMiles << endl;}
Computers and Technology
1 answer:
ryzh [129]3 years ago
6 0

Answer:

Following are th program in the C++ Programming Language.

#include <iostream>//set Header files

using namespace std;//set namespace

//define main function

int main()

{

//set integer constants variable

const int NUM_ROWS = 2;

//set integer constants variable

const int NUM_COLS = 2;

//set integer type array

int milesTracker[NUM_ROWS][NUM_COLS];

//set integer type variable and initialize to 0

int i = 0;

//set integer type variable and initialize to 0

int j = 0;

//set integer type variable and initialize to -99

int maxMiles = -99;

//set integer type variable and initialize to -99

int minMiles = -99;

//initialize the value in the two dimensional array

milesTracker[0][0] = -10;

milesTracker[0][1] = 20;

milesTracker[1][0] = 30;

milesTracker[1][1] = 40;

//here is the solution  

maxMiles = milesTracker[0][0];

minMiles = milesTracker[0][0];

/*set for loop to find the minimum miles and maximum miles*/

for (i = 0; i < NUM_ROWS; i++)

{

 for (j = 0; j < NUM_COLS; j++)

 {

 //set if condition for maxMiles is the bigger than

   if (milesTracker[i][j] > maxMiles)

   //initialize milesTracker[i][j] to maxMiles

     maxMiles = milesTracker[i][j];

   //set if condition for minMiles is the smaller than

   if (milesTracker[i][j] < minMiles)

   //initialize milesTracker[i][j] to maxMiles

     minMiles = milesTracker[i][j];

 }

}

//print output

cout << "Min miles: " << minMiles << endl;

//print output

cout << "Max miles: " << maxMiles << endl;

return 0;

}

<u>Output:</u>

Min miles: -10

Max miles: 40

Explanation:

Here, we define the main method and inside it:

  • set two constant integer type variable and initialize to 2
  • set integer type two-dimensional array and pass constant variables in it.
  • Set two integer type variable and initialize to 0 then, again set two integer type variable and initialize to -99.
  • Initialize the values in the two-dimensional array.
  • Set two for loop for the two-dimensional array to find the minimum and maximum miles.
  • Set two if condition to find bigger or smaller miles.

Finally, print the maximum and the minimum miles then, return 0.

You might be interested in
If I deal seven cards from a standard deck of 52, what is the chance that I will get two triples (three of a kind) and one other
Nadya [2.5K]

Answer:

3.417 X 10^{-9}

Explanation:

Dealing seven cards indicates that they are not being replaced. The chance o getting two triples and one other card is as follows:

P(king of hearts) = 4/52 = 1/13 This is because there are 4 kings in a deck of cards.

P(king of spades) = 3/51 = 1/17 This is because there are three kings left in the deck and 51 cards left in the deck

P(king of spades) = 2/50 = 1/25 reduced number of kings and cards

P(Ten of diamonds) = 4/49 There are four tens in the deck but there are only 49 cards there.

P(ten of spades) = 3/48 = 1/16 Reduced number of tens and cards

P(ten of clubs) = 2/47

P(Three of hearts) = 4/46 There are four threes in a now reduced deck.

P(three of a kind and one other card): (1/13)(1/17)(1/25)(4/49)(1/16)(2/47)(4/46)

numerators = 1 X 1 X 1 X 4 X 1 X 2 X 4 = 32

denominators = 13 X 17 X 25 X 49 X 16 X 47 X 46 = 9364919200

numerators/denominators = 32/9364919200 = 3.417 X 10^{-9}

8 0
3 years ago
Read 2 more answers
A water park will let a visitor on a ride if they are 48 or more inches tall OR they are 14 years old or older. WILL MARK BRAINL
Pavel [41]

Answer:

function waterPark() {

   var age = parseInt(prompt("Enter your Age: "));

   var height = parseInt(prompt("Enter your Height (in inches): "));

   if ( age >= 14 || height >= 48){

       console.log("You can ride in our park");

   } else {

        console.log("You are not eligible to ride in the park");

   }

}

waterPark( );

Explanation:

The Javascript function "waterPark" prompts users for their age and height to check if they are eligible to ride in the park. The prompt is parsed to an integer and assign respectively to the age and height variable.

The if conditional statement compares the age and height of the user to know if they are eligible to ride in the park or not.

6 0
3 years ago
What is the output of the following C++ code? int list[5] = {0, 5, 10, 15, 20}; int j; for (j = 0; j &lt; 5; j++) cout &lt;&lt;
sesenic [268]

Answer:

what?

Explanation:

8 0
3 years ago
When a browser is open on your computer, what browser tool is used to move the webpage to the previously viewed page on the brow
ch4aika [34]

Answer:

back arrow button

Explanation:

7 0
3 years ago
Why is experience in their own factory setting
Nataly [62]

Answer:

How to Manage Manufacturing Operations Effectively

Ensure High-Quality Products. ...

Ensure High-Quality Equipment. ...

Know How To Maximize Resources. ...

Look Into Technological Advancements. ...

Check Your Customer Service. ...

Consider Reducing Waste. ...

Conclusion.

Explanation:

5 0
3 years ago
Other questions:
  • You work for a large enterprise company that handles time-sensitive information. Your supervisor has asked that you set up a con
    8·1 answer
  • Spreadshet formula to add totals​
    12·1 answer
  • Most documents are printed in ______ orientation
    9·2 answers
  • "Most of us know that when we come into a college classroom, we will see desks and chairs, a computer station and a projector. A
    6·1 answer
  • Which statement best expresses the use of Internet sources in a research project versus other types of sources?
    14·1 answer
  • State The function<br>of floppy disk​
    10·1 answer
  • 40 is 20 % percent of what?​
    9·1 answer
  • 2y/3 - y-1/6 + 7y-1/4 = 2 1/6​
    5·1 answer
  • User name ideas for ro blox? I'm changing mine and I dont know what I want. No numbers or underscores!
    10·2 answers
  • True or False: Once you rename a field, the new field name must be used in the rest of the search string.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!