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
slava [35]
3 years ago
14

Write a program that uses a 2-D array to store the highest and lowest temperatures for each month of the year. The program shoul

d output the average high, average low, and highest and lowest temperatures of the year. Your program must consist of the following methods with their appropriate parameters:
Computers and Technology
1 answer:
dedylja [7]3 years ago
7 0

Answer:

*/

import java.util.*;

public class Main{

public static void main(String[] args){

 

int infoArray[][]=getData();

int avgArray[][]=average(infoArray);

int tempArray[][]=temps(infoArray);

System.out.println("Data set - Highs: 87,99,100,102,101,97,97,93,99,94,98,92.");  

System.out.println("Lows: 11,12,19,24,23,25,32,33,29,21,10,1.");

System.out.println("Average High: "+avgArray[0][0]);

System.out.println("Average Low: "+avgArray[1][0]);

System.out.println("Highest Temperature: "+tempArray[0][0]);

System.out.println("Lowest Temperature: "+tempArray[1][0]);

}

public static int[][] getData(){

 int tempDatahl[][] = {{87,99,100,102,101,97,97,93,99,94,98,92},{11,12,19,24,23,25,32,33,29,21,10,1}};

 return tempDatahl;

}

public static int[][] average(int x[][]){

int avgH = 0;

int avgL = 0;

 

//loop to find avg high

 for(int i=0;i<x[0].length;i++){

     avgH+=x[0][i]  ;

}

 

//loop to find avg low

 for(int h=0;h<x[1].length;h++){

     avgL+=x[1][h]  ;

}  

 

 avgH=avgH/x[0].length;

 avgL=avgL/x[1].length;

 

 int avgData[][] = {{avgH},{avgL}};

 return avgData;

}

public static int[][] temps(int x[][]){

 //high temp

 int ht = 0;

 int lt = 100;

 

 for(int t=0;t<x[0].length;t++){

   if(x[0][t]>ht){

     ht = x[0][t];

   }

 }

 //low temp

  for(int y=0;y<x[1].length;y++){

   if(x[1][y]<lt){

     lt = x[1][y];

   }

 }  

      int arrTemps[][]={{ht},{lt}};

     return arrTemps;

}

 

}

Explanation:

You might be interested in
What program has unique drag and drop support functions?
Alenkasestr [34]

Answer:

theres actually alot

Explanation:

apple has a drop file function where you drag and drop

ill name a few

dropbox, apple, windows, linux etc.

7 0
3 years ago
Fill in the sentences with the correct terms.
ololo11 [35]
<h2>[+] Hello ! [+]</h2>

Answer:

<em>Cells provide data to another cell. </em>

<em>Cells rely on the value of another cell. </em>

Explanation:

  • I hope this helped
  • Tell me if it's wrong
  • Thanks for your time
  • Brainliest is always appreciated!!
  • Have a wonderful and blessed day :D
5 0
3 years ago
Read 2 more answers
Rachel is on her way to an interview for the position of a project manager. She is trying to prepare for this interview by analy
Fittoniya [83]

The answer would be A.


5 0
3 years ago
Item 19 A student pushes a box across a rough horizontal floor. If the amount of work done by the student on the box is 100 J an
tatiyna

Answer:

60 J

Explanation:

Given,

Work done to push the box = 100 J

Energy dissipated by friction = 40 J.

According to work energy theorem work done is equal to change in kinetic energy.

Change in Kinetic energy = Work done by student + Work done by friction

Change in Kinetic energy = 100 J - 40 J

Work done by the friction will be negative because it will act in opposite direction of force applied.

Change in Kinetic energy = 60 J

4 0
4 years ago
Theresa is a certified teacher. She just had a baby and would like to stay home, but still wants to teach. Which career would be
vesna_86 [32]
I think it will be online classes (B.)
8 0
3 years ago
Read 2 more answers
Other questions:
  • What is the difference in adware and spyware
    11·2 answers
  • A number of technical mechanisms—digital watermarks and embedded code, copyright codes, and even the intentional placement of ba
    5·1 answer
  • Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the ga
    12·2 answers
  • You suspect that an attacker has hidden files on your machine. What Linux command would you use to search for files with a file
    14·1 answer
  • Problem: you need to write a code that read 2 array of size 10x10 of zero and ones that represent black
    8·1 answer
  • Assume that PrecinctReport is a structured type with these fields, address (a string), and three int fields which are counts of
    9·1 answer
  • Having friends who cause you stress can decrease your happiness, which can in turn
    13·2 answers
  • Rey is recording the dialogues and sound effects separately in the studio, as he is not happy with the sound quality recorded on
    9·1 answer
  • An algorithm whose worst-case time complexity is bounded above by a polynomial function of its size is called a(n)
    13·1 answer
  • Sean is frustrated with having to use separate editors, compilers, libraries, plug-ins, and debugers. What could Sean use to mak
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!