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 is the iterative procedure of recursive and nonrecursive?
DanielleElmas [232]

Answer:

nonrecursive

Explanation:

3 0
2 years ago
What leadership style involves the ideas of advice others
makvit [3.9K]
Democrat good luck dude
5 0
2 years ago
Alkane is a Variety of which fruit
icang [17]
Several different alkane fruits.
watermelon cantaloupe mango pears grapes passion fruit dried fruits like dates and apricots figs and raisins are also considered heavy alkaline foods apples, fresh apricots bananas berries and avocados.... list goes on.
4 0
3 years ago
Jeff is a financial assistant. He needs to create a document for his client that tracks her stocks and calculates the loss or ga
seropon [69]
Spreadsheet. Brainliest answer plz??
4 0
3 years ago
Read 2 more answers
How do you make a ringtone on earsketch
RoseWind [281]

Haven't used earsketch, but here we go.

Answer:

1). Make a track in earsketch, make it like 6/7 seconds

2.) export your track as an .mp3, .wav, or  .ogg (your choice!)

3.) (If on android) Navigate to settings, now search for an entry for ringtone.

4.) If you have no luck, look up how to set ringtone on your desired phone brand (iOS, Android, etc.)

5.) Test out your new ringtone

6.)Profit

4 0
2 years ago
Other questions:
  • ¿Cuál es el objetivo principal de los servicios?
    7·1 answer
  • Current versions of windows support file names up to ________ characters long
    5·1 answer
  • Which is true about lists and stacks?
    8·1 answer
  • what is hyperlink a)the text contained in hypertext documents b)a service provided by the internet c) the location of web pge on
    12·1 answer
  • Certain files, such as the ____ and Security log in Windows, might lose essential network activity records if power is terminate
    9·1 answer
  • What is the BCC feature used for?
    12·2 answers
  • Write a sed command that will display all lines of the birthday file that do not contain the string March. What was the sed comm
    13·1 answer
  • Golf scores record the number of strokes used to get the ball in the hole. The expected number of strokes varies from hole to ho
    5·1 answer
  • What does this mean? And how did I get it?
    12·2 answers
  • 1. what is the purpose of giving an id to an html element when using javascript?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!