# Java Program Help!:((



## paupau0612 (Sep 15, 2011)

//Write program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. The program should output the average high, average low, and highest and lowest temperatures of the year. Your program must consist of the following methods:
//A. Method getDate: this method reads and stores the data in the two-dimensinal array 
//B. Method averageHigh: this method calculates and returns the average high temperature of //the year.
//C. Method averageLow: This method calculates and returns the average low temperatue of the //year.
//D. Methos indexHighTemp: This method returns the index of the highest temperature in the //array.
//E. Method indexLowTemp: This metohd returns the index of the lowest temperature in the //array.
//(These methods must have all the appropriate parameters)

import java.util.Scanner;

public class MidExer {
static Scanner console = new Scanner(System.in);

public static void main(String[] args) { 
double[][] temp = new double[11][1];
}


public void getDate(double[][] temp) {
}

public double averageHigh() {
double dblAveHigh=0;
//Process
return dblAveHigh;
}

public double averageLow() {
double dblAveLow=0;
//Process
return dblAveLow;
}

public int indexHighTemp() {
int intIndexHigh=0;
//Process
return intIndexHigh;
}

public int indexLowTemp() {
int intIndexLow=0;
//Process
return intIndexLow;
}

}

i have the skeleton of the problem but i dont know how to finish it.. i dont know how to call the methods each should have its own parameters.. thanks guys!


----------



## paupau0612 (Sep 15, 2011)

please help me guys!


----------



## Special2God (Oct 5, 2009)

I would like to help you, however this sounds like a school project


> 2) We cannot help you with your homework. As stated in the Terms of Use to which you agreed,
> 
> 
> > You may not ask for assistance with homework assignments, projects or book reports for school college or university


I do not feel that it is right to intervene in the learning process. 
When writing code for real, you must be competent at finding and fixing bugs. Fixing bugs is part of the learning process. While you may occasionally ask for assistance in fixing difficult bugs in your project, this is something you must, for the most part, learn to do yourself.

The one exception to this rule is if you cannot understand your assignment. In that case, you may post the assignment to us verbatim (word for word) and we will be happy to help you to understand it. 

If you do not understand the assignment, post back a more specific question regarding what you do not understand and we will try to help. 
Please do not ask us to write code for you, that is part of the fun/grind of learning to program.


----------



## Ninjaboi (Dec 27, 2010)

Hello paupau0612!

Unfortunately, we are unable to help you with school assignments as per the forum rules:



> You may not ask for assistance with homework assignments, projects or book reports for school college or university


We can however push you in the right direction ( without of course doing the code for you ). 

The two-dimentional array should have one dimention hold the highs of that year, and the other the lows of that year. "averageHigh()" should take the values from the dimension that holds the highs of that year and average them out using basic math. "averageLow()" should take the values from the dimension that holds the lows of that year and average them out using basic math. "indexHighTemp()" should compare all the values from the dimension that holds the highs of that year and find the highest value. "indexLowTemp()" should compare all the values from the dimension that holds the lows of that year and find the lowest value.

EDIT:

Just as Special2God said, we are unable to intervene with the learning process. We cannot do the code for you, and we cannot answer problems that directly correlate with the assignment given. We can help you understand the directions of what you should be doing, but beyond that are unable to assist further.


----------



## paupau0612 (Sep 15, 2011)

this is not my hw or project.. i am just trying to answer the exercises at my book.. im doing this for hours but i cant answer it. im searching to the internet how can i do this and i came up of doing the frame only.. can you give me some clues or hint how can i finish this?


----------



## Ninjaboi (Dec 27, 2010)

What book are you using? Most books come with the exercises answered in the back of the book ( or at the book author's website ). As for any clue/hint for helping you, please reread what I said in my previous post:



> The two-dimensional array should have one dimension hold the highs of that year, and the other the lows of that year. "averageHigh()" should take the values from the dimension that holds the highs of that year and average them out using basic math. "averageLow()" should take the values from the dimension that holds the lows of that year and average them out using basic math. "indexHighTemp()" should compare all the values from the dimension that holds the highs of that year and find the highest value. "indexLowTemp()" should compare all the values from the dimension that holds the lows of that year and find the lowest value.


I'll go into slightly more detail and separate the 5 tips into small paragraphs to make it easier to understand.



> The two-dimensional array should have one dimension hold the highs of that year, and the other the lows of that year.


A two-dimensional array in this case would suit the high and low temperatures of each day of a given time ( in this case a year ). One dimension of the array can be specialized to only hold the highs of each day, while the other dimension of the array can be specialized to only hold the lows of each day.



> "averageHigh()" should take the values from the dimension that holds the highs of that year and average them out using basic math.


The method "averageHigh()" you are trying to make needs to process through all the *high* temperature values in the array and average them out. Averaging is simply taking the values, adding them together, and dividing this added value by the number of values added together ( The average of 2 + 2 + 2 is 2, for 2 + 2 + 2 = 6 / 3 = 2 ).



> "averageLow()" should take the values from the dimension that holds the lows of that year and average them out using basic math.


The method "averageLow()" you are trying to make needs to process through all the *low* temperature values in the array and average them out. Averaging is simply taking the values, adding them together, and dividing this added value by the number of values added together ( The average of 2 + 2 + 2 is 2, for 2 + 2 + 2 = 6 / 3 = 2 ).



> "indexHighTemp()" should compare all the values from the dimension that holds the highs of that year and find the highest value.


The method "indexHighTemp()" you are trying to make needs to process through all the high temperature values in the array and find the highest value. This will mean comparing each value and taking the highest of the values.



> "indexLowTemp()" should compare all the values from the dimension that holds the lows of that year and find the lowest value.


The method "indexLowTemp()" you are trying to make needs to process through all the low temperature values in the array and find the lowest value. This will mean comparing each value and taking the lowest of the values.

Hope that helps you understand what you should be doing. Even if you say it's not homework or a school assignment, we have to be on the safe side in this situation. Even if it's not homework, we wouldn't help you much beyond what I'm already doing ( as we don't do the work for you ).

Best of luck to you, and happy coding!


----------

