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
Precautionary measures to be observed when using ICT tools​
Dafna11 [192]

Answer:

ICT is the abbreviated form of Information and Communication. It included different technologies like mobile phones, computers, USBs etc.

Following are two precautionary measures which should be observed when using any kind of ICT:

  1. Use of Antivirus: It can used to protect anything placed inside the technology especially from hacking and viruses which can create many issues.
  2. Backup Data: Creating a backup of the data stored in the device is important as it can be recalled when the device malfunctions. Backup of the data can be created through using USBs, CDs etc or through cloud storage
7 0
3 years ago
What is an example of an assumption and dependency that an automated stocking application project would include in an SRS?
Natasha2012 [34]

Explanation:

software must be used by well trained staff.

6 0
2 years ago
In 1971, Intel created and marketed the first microprocessor chip, called the Intel 4004. What was significant about this invent
PilotLPTM [1.2K]
The answer is D

<span>D) It allowed computers to be smaller because the chip allowed for the creation of computer components with varying capabilities.</span>
7 0
3 years ago
Select the correct answer.
Vladimir79 [104]

Answer:

I think make a copy maybe

Explanation:

4 0
3 years ago
Read 2 more answers
An operating system that allows a single user to work on two or more programs at the same time is what type of OS?
Lisa [10]

Answer:

Explanation:

The correct answer is none of these

An operating system that allows a single user to perform only one task at a time is called a Single-User Single-Tasking Operating System. Functions like printing a document, downloading images, etc., can be performed only one at a time. Examples include MS-DOS, Palm OS, etc.

Advantage: This operating system occupies less space in memory.

Disadvantage: It can perform only a single task at a time.

There are four types of operating systems −

Real-time operating system

Single-User/Single-Tasking operating system

Single-User/Multitasking operating system

Multi-User/Multitasking operating system

Real-time operating system is designed to run real-time applications. It can be both single- and multi-tasking. Examples include Abbasi, AMX RTOS, etc.

An operating system that allows a single user to perform more than one task at a time is called Single-User Multitasking Operating System. Examples include Microsoft Windows and Macintosh OS.

It is an operating system that permits several users to utilize the programs that are concurrently running on a single network server. The single network server is termed as "Terminal server". "Terminal client" is a software that supports user sessions. Examples include UNIX, MVS, etc.

5 0
2 years ago
Other questions:
  • A. experiment by purposely misconfiguring the gateway address on pc-a to 10.0.0.1. what happens when you try and ping from pc-b
    14·1 answer
  • Differentiate between third and fourth generation of computer​
    6·1 answer
  • Which network is the predecessor of the Internet?
    13·1 answer
  • Monica spent a lot of time preparing for her interview, but the hiring manager is not asking any of the questions she practiced.
    9·2 answers
  • You have just finished upgrading the 250 w power supply in your desktop computer to a 450 w power supply. now the bios doesn't r
    7·1 answer
  • Why are online payment services necessary?
    10·2 answers
  • Entering the search criteria "B?" would yield which of the following results?
    6·1 answer
  • Primary technology skills are skills that are necessary for success in online education
    9·2 answers
  • What is the code i need to do
    12·1 answer
  • In the Create Sparkline dialog, the _______ box refers to the cell range where you want the Sparklines to appear.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!