Results 1 to 6 of 6
Thread: help with my 2d arrays please
 01122014, 12:43 PM #1Member
 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 Autogenerated method stub double[][] values = new double[3][4]; int[][] rounded = new int[3][4]; 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++) { values[i][x]=gui.getDouble("please enter temperature"); 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]< 400values[x=1][i]<400values[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[0][0]); //System.out.println(rounded[0][0]); } }
 01122014, 02:54 PM #2Member
 Join Date
 Jan 2014
 Posts
 7
 Rep Power
 0
 01122014, 03:10 PM #3Senior Member
 Join Date
 Jan 2011
 Location
 Belgrade, Serbia
 Posts
 301
 Rep Power
 4
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?
 01122014, 03:24 PM #4Member
 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 [3][4] 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
 01122014, 03:33 PM #5Member
 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
 01122014, 04:07 PM #6Member
 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 [3][4] 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
Similar Threads

Copying Single Arrays to 2D Arrays
By jmscarlet9 in forum New To JavaReplies: 7Last Post: 04022012, 11:17 PM 
Casting Enum Type arrays to object type arrays
By nmvictor in forum Advanced JavaReplies: 4Last Post: 02172012, 12:49 PM 
arrays and multidimensional arrays
By belfast09 in forum New To JavaReplies: 5Last Post: 06142011, 01:28 PM 
store array of arrays in array of arrays
By joost_m in forum New To JavaReplies: 4Last Post: 04192010, 10:32 AM 
Arrays.sort... why sorting all arrays in class?
By innspiron in forum New To JavaReplies: 6Last Post: 03232010, 01:40 AM
Bookmarks