1. Member Join Date
Jan 2014
Posts
7
Rep Power
0

## help with my 2d arrays please

i have 4 elements eachs containg 3 points and i want to check if each point is in range of 395 to 405 if not display that point with error message. im also if all 3 points on an element are under 400 i want do display an error aswell i think im very nearly there but i had to remover for loops to prevent continuos output can somone help please.

Java Code:
```import SE112aClasses.*;

public class Burger {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

double[][] values = new double;
int[][] rounded = new int;
int tempi=0;
int tempx=0;
int i=0;
int x=0;

GUI gui =new GUI();

for(i=0;i<3;i++)
{
for( x=0;x<4;x++)
{

rounded[i][x]=(int)Math.round(values[i][x]);

}

}
//for(int i=0;i<3;i++)
//{
//for(int x=0;x<4;x++)
//{

tempi=i;
tempx=x;
if(rounded[i][x]<395 || rounded[i][x] >405)
{
System.out.println("there is an error with probe "+tempi+","+tempx+" :"+rounded[i][x]);

}

//}
//}

//	 for(int i=0;i<3;i++)
//	{
//for(int x=0;x<4;x++)
//	{

else if(values[x=0][i]< 400||values[x=1][i]<400||values[x=2][i]<400)
{
System.out.println("all points in element "+tempi+"as they are below 400 needs replaced("+"point "+tempx+" : "+values[i][x]+")");

}

//	}
//}

//System.out.println(values);
//System.out.println(rounded);

}

}```  Reply With Quote

2. Member Join Date
Jan 2014
Posts
7
Rep Power
0

## Re: help with my 2d arrays please Originally Posted by allan i have 4 elements eachs containg 3 points and i want to check if each point is in range of 395 to 405 if not display that point with error message. im also if all 3 points on an element are under 400 i want do display an error aswell i think im very nearly there but i had to remover for loops to prevent continuos output can somone help please.

Java Code:
```import SE112aClasses.*;

public class Burger {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

double[][] values = new double;
int[][] rounded = new int;
int tempi=0;
int tempx=0;
int i=0;
int x=0;

GUI gui =new GUI();

for(i=0;i<3;i++)
{
for( x=0;x<4;x++)
{

rounded[i][x]=(int)Math.round(values[i][x]);

}

}
//for(int i=0;i<3;i++)
//{
//for(int x=0;x<4;x++)
//{

tempi=i;
tempx=x;
if(rounded[i][x]<395 || rounded[i][x] >405)
{
System.out.println("there is an error with probe "+tempi+","+tempx+" :"+rounded[i][x]);

}

//}
//}

//	 for(int i=0;i<3;i++)
//	{
//for(int x=0;x<4;x++)
//	{

else if(values[x=0][i]< 400||values[x=1][i]<400||values[x=2][i]<400)
{
System.out.println("all points in element "+tempi+"as they are below 400 needs replaced("+"point "+tempx+" : "+values[i][x]+")");

}

//	}
//}

//System.out.println(values);
//System.out.println(rounded);

}

}```
I have noted that noone has replieid have i put this in the wrong section ? just clarify i know how to store my 2d arrays im just looking for advice on how to obtain the required output  Reply With Quote

3. Senior Member Join Date
Jan 2011
Location
Posts
311
Rep Power
10

## Re: help with my 2d arrays please

what is current status? how your code works now, what is the output and what is wrong with it?  Reply With Quote

4. Member Join Date
Jan 2014
Posts
7
Rep Power
0

## Re: help with my 2d arrays please

it reads in 12 different tempatures into all 12 points which are stored into 2d array set at  to the nearest whole number and checks to see if they are in range between 395 and 405
then returns error mesage wtih coreect index and value of point that is out of range i think that works when that if is inside the second for loop which i have commented out just now the problem is the seconf test condition im trying to check if every point on an element wich holds 3 points is under 400 if true out put error with that element displayed also listing each point of that element . this one dosen't work correctly  Reply With Quote

5. Member Join Date
Jan 2014
Posts
7
Rep Power
0

## Re: help with my 2d arrays please

let me know you need more info im new to this form thanks  Reply With Quote

6. Member Join Date
Jan 2014
Posts
7
Rep Power
0

## Re: help with my 2d arrays please

it reads in 12 different tempatures into all 12 points which are stored into 2d array set at  to the nearest whole number and checks to see if they are in range between 395 and 405
then returns error mesage wtih coreect index and value of point that is out of range i think that works when that if is inside the second for loop which i have commented out just now the problem is the seconf test condition im trying to check if every point on an element wich holds 3 points is under 400 if true out put error with that element displayed also listing each point of that element . this one dosen't work correctly  Reply With Quote

java environment support 