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
Artist 52 [7]
3 years ago
9

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:
lina2011 [118]3 years ago
8 0

Answer: 40, 4

Explanation:

You might be interested in
In this assignment, you will develop a C++ program and a flowchart that calculates a cost to replace all tablets and desktop com
Alexeev081 [22]

Answer:

Explanation:

The objective of this program we are to develop is to compute a C++ program and a flowchart that calculates a cost to replace all tablets and desktop computers in a business.

C++ Program

#include<iostream>

#include<iomanip>

using namespace std;

/*

⦁ // Name:

⦁ // Date:

⦁ // Program Name:

⦁ // Description:

*/

int main()

{

const double SalesTaxRate = .075, DiscountPercent = .10, FinanceCharge = .15;

const double TABLET = 320.00, DESKTOP = 800.00;

double total = 0.0, subTotal = 0.0,avg=0.0;

int numberOfTablets, numberOfDesktop;

cout << "-------------- Welcome to Computer Selling Company ------------------ ";

cout << "Enter number of tablets: ";

cin >> numberOfTablets;

cout << "Enter number of desktops: ";

cin >> numberOfDesktop;

subTotal = TABLET * numberOfTablets + numberOfDesktop * DESKTOP;

char choice;

cout << "Paying cash or financing: (c/f): ";

cin >> choice;

cout << fixed << setprecision(2);

if (choice == 'c' || choice == 'C')

{

cout << "You have choosen paying cash." << endl;

total = subTotal - subTotal * DiscountPercent;

cout << "Discount you get $" << subTotal * DiscountPercent<<endl;

cout << "Sales Tax: $" << SalesTaxRate * total << endl;

total = total + total * SalesTaxRate;

cout << "Total computers' Cost: $" << total << endl;

avg = total / (numberOfDesktop + numberOfTablets);

cout << "Average computer cost: $ " << avg << endl;

}

else if (choice == 'f' || choice == 'F')

{

cout << "You have choosen Finance option." << endl;

total = subTotal + subTotal * FinanceCharge;

cout << "Finance Charge $" << subTotal * FinanceCharge << endl;

cout << "Sales Tax: $" << SalesTaxRate * total << endl;

total = total + total * SalesTaxRate;

cout << "Total computers' Cost: $" << total << endl;

avg = total / (numberOfDesktop + numberOfTablets);

cout << "Average computer cost: $ " << avg << endl;

}

else

{

cout << "Wrong choice.......Existing.... ";

system("pause");

}

//to hold the output screen

system("pause");

} }

OUTPUT:

The Output of the program is shown in the first data file attached below:

FLOWCHART:

See the second diagram attached for the designed flowchart.

5 0
3 years ago
Company-wide systems that connect one or more local area networks (LANs) or wide area networks (WANs) are called _____.
fgiga [73]
Web-centric systems
3 0
3 years ago
Some of your non-Windows clients aren't registering their hostnames with the DNS server. You don't require secure updates on the
Ivenika [448]

Answer:

c.Update DNS records dynamically for DHCP clients that don't request updates.

Explanation:

A DNS server is a computer server that contains a database of public IP addresses and their associated host names, and in most cases serves to resolve, or translate, those names to IP addresses as requested.

A DHCP Server is a network server that automatically provides and assigns IP addresses, default gateways and other network parameters to client devices.

Dynamic DNS is a method of automatically updating a name server in the Domain Name Server, often in real time.

5 0
3 years ago
Write a loop that sets each vector element to the sum of itself and the next element, except for the last element which stays th
Gekata [30.6K]

Answer:

Add the following lines of code to the already existing code segment

<em>for (i = 0; i < SCORES_SIZE-1; ++i) { </em>

<em>        bonusScores.at(i) = bonusScores.at(i) + bonusScores.at(i+1);</em>

<em>  }</em>

Explanation:

To do the task in the question, we have to iterate through the vector from the first element i.e. element at index 0 to the second to the last element; i.e. element at last index - 1

We then add each element in this iteration with the next.

This iterates through the vector from 0 to SCORES_SIZE - 1

<em>for (i = 0; i < SCORES_SIZE-1; ++i) { </em>

<em>This adds each vector element with the next</em>

<em>        bonusScores.at(i) = bonusScores.at(i) + bonusScores.at(i+1);</em>

<em>  }</em>

The above should be added before

<em>for (i = 0; i < SCORES_SIZE; ++i) { </em>

<em>        cout << bonusScores.at(i) << " "; </em>

<em>}</em>

<em />

<em>Also, I've made other modifications to the program.</em>

  • <em>Proper import of header files</em>
  • <em>Proper declaration of vector bonusScores</em>

<em />

<em>See attachment for complete source code</em>

Download cpp
6 0
3 years ago
Shelby is in a college course for half the day and then goes to high school. What program is she in?
Alexus [3.1K]
Dual Credit: Dual credit allows you to take a college course while in High school to earn that particular credit! Hope this helps. 
7 0
3 years ago
Read 2 more answers
Other questions:
  • With network management software, a network manager can ____.
    6·1 answer
  • Which phone has the most GB (Gigo Bites)<br><br>A.Samsung<br>B.Iphone<br>C.LG<br>D.ZTE
    10·2 answers
  • What's the problem with this code ?
    14·1 answer
  • You want to purchase a new hard drive for your workstation and are deciding between an HDD and an SDD. Which of the following is
    13·1 answer
  • - Consider the relation R = {A, B, C, D, E, F, G, H, I, J} and the set of functional dependencies F = { {B, C} -&gt; {D}, {B} -&
    14·1 answer
  • The U.S. National Institute of Standards and Technology defines the incident response life cycle as having four main processes:
    13·1 answer
  • As part of a team, you are assigned to create a financial report. One of your tasks is to put the pieces together as other team
    5·1 answer
  • How did<br> technological artifacts evolved over time?
    15·1 answer
  • HOWARD!!!!!! THE PHONE IS RINGING!!!!!!!!!
    6·2 answers
  • Which of the following is typiacally the last step of the mail merge process
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!