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
An information system report is an example of...
STatiana [176]

Answer:

a. data processing

b. data collection

c. data input

d. data output

Explanation:

An information system is a system used to filter, process, collect, distribute and create data.

Information system can be a work system whereby humans and machine perform processess using informations gathered, process it to solve the needs of their customers in the form of goods and services.

8 0
4 years ago
Respond to the following in three to five sentences. Select the workplace skill, habit, or attitude described in this chapter th
Serjik [45]

A skilled and successful worker is any worker who has special skill, training, knowledge, and (usually acquired) ability in their work. A skilled worker may have attended a college, university or technical school. Or, a skilled worker may have learned their skills on the job. Examples of skilled labor include engineers, software development, paramedics, police officers, soldiers, physicians, crane operators, truck drivers, machinist, drafters, plumbers, craftsmen, cooks and accountants. These workers can be either blue-collar or white-collar workers, with varied levels of training or education.

1. They Think About the Skills They Need for the Next Job

We all (OK, most of us) try to be awesome at the skills in our job descriptions, but the most successful people also focus on what they’ll need to know to succeed in their next jobs. Not sure what skills you should be developing? Check out career expert Laura Katen’s tips for honing in on exactly what to reach for next.

2. They Speak Up in Meetings

Especially if you’re in a large meeting, intimidated by the higher-ups there, or don’t know much about what’s going on, it’s easy to sit tight and listen. But the people who get ahead don’t wait for permission or an invitation to speak—they make sure everyone in the room knows they have something to contribute. Even if you don’t have a suggestion? “Speaking up to advocate for a co-worker’s point of view or asking a well thought-out question can go just as far,” says leadership coach Jo Miller.

3. They Dress for the Job They Want

You’ve heard it a thousand times—but it consistently holds true. People who get ahead at work look to those above them and emulate not only the clothes they wear, but the ways in which they present themselves in the office, interact with others, and approach their work.

4. They Get to Know the Higher-Ups

It’s pretty hard to get promoted if your boss’ boss doesn’t know who you are—so make it a point to get to know the higher-ups in your department. Check out Sara McCord’s tips for talking to your boss’ boss the right way.

5. They Know How to Communicate With Those Higher-Ups

If you’ve ever been in an executive-level meeting, you know that c-suiters communicate a bit differently than the rest of us. So, if you want to make it there someday, it’s key to learn how to talk the talk. Career coach Lea McLeod gives a few tips for getting started.

8 0
4 years ago
Read 2 more answers
My computer keeps shutting down I've tried to completely wipe the memory but it didn't work do you have any ideas how to fix it
seropon [69]

Answer:

You could have a bug, virus, or you might have been hacked the most I can tell you is try to contact a technician to check it and try to help you. It could also be a problem with your internet, maybe you hit your computer against something and it broke something inside, or it could be a technical glitch. I hop this helps! Good Luck fixing your computer!

8 0
3 years ago
When a router fails to send messages in a timely fashion, this is a problem of the _____.
natima [27]
<span>network layer  

hope it helped</span>
4 0
3 years ago
You can change the ____ or position of text within a document's margins.
ahrayia [7]

Answer:

Alignment

Explanation:

That should be correct

7 0
3 years ago
Other questions:
  • What kinds of unstructured data or big data might the BITS corporation want to gather in the future? What kind of devices might
    14·1 answer
  • How can I get more Gems in the game {Fashion Empire} through a Fire kindle?
    15·2 answers
  • Processing is handled by the computer’s central processing unit (cpu).​ <br> a. True <br> b. False
    6·1 answer
  • A university wants to install a client-server network. Which feature do you think is important for them as they set up the netwo
    8·1 answer
  • What is a complex instruction set computer chip? Multiple Choice Performs all arithmetic operations (for example, addition and s
    6·1 answer
  • The language C was originally developed by​
    11·2 answers
  • You might have trouble interpreting a message if:
    15·1 answer
  • Smileys Pizzeria has a special on cheese pizza this month. 6- inch personal pizzas are $5, 10-inch small pizzas are $8, 14-inch
    6·1 answer
  • How could you insert a new row between rows 20 and 21?
    7·2 answers
  • Pls help me!! I will give 35 points and mark brainliest !!!
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!