Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Threaded View

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Need help in multidimensional array

    As title shown above,anyone know how to fix this?

    I wanna get the out put like dis:
    I m getting confusing about the coding as trying to do...hope someone can help me..^^

    Output:
    Example:
    Employee number 1001
    average number of his/her feedback is 2.83
    The grade for this employee is C
    Employee number 1002

    and so on until 1005..

    I think the program is easy ,I just get some confuse in some part...

    Coding:
    public class latihan {
    public static void main (String []args)
    {
     
    int employeenumber[]={1001,1002,1003,1004,1005};
    float averageFeedback=0;
    float a[]=new float [5];
    float [][][] result={
    {{3.5f, 2.2f, 2.8f}},
    {{2.6f, 3.0f, 3.7f}},
    {{4.0f, 3.4f, 1.0f}},
    {{1.0f, 1.9f, 3.9f}},
    {{4.0f, 4.0f, 4.0f}}
    };
    char arraygrade[]=new char[5];
     
     
     
    for(int i=0;i<result.length;i++)
    {
    a[i]=averageFeedback/3;
     
     
     
    for(int j=0;j<result[i].length;j++)
    {
     
    for(int k=0;k<result[i][j].length;k++)
     
    {
    averageFeedback+=(result[i][j][k]);
     
    if(averageFeedback<2)
    {
    arraygrade[k]='D';
    }
    else if(averageFeedback<3)
    {
    arraygrade[k]='C';
    }
    else if(averageFeedback<4)
    {
    arraygrade[k]='B';
    }
    else
    {
    arraygrade[k]='A';
     
    }
     
     
     
     
     
    }
    }
     
     
    }
    for(int l=0;l<5;l++)
    {
     
    System.out.println("Employee number "+employeenumber[l]);
    System.out.println("average number of his/her feedback is "+a[l]);
    System.out.println("The grade for this employee is "+arraygrade[l]);
     
    }
     
     
    }}
    Last edited by Stefan_Lam; January 14th, 2010 at 12:22 AM.


Similar Threads

  1. Object array to int array?
    By rsala004 in forum Collections and Generics
    Replies: 1
    Last Post: October 30th, 2009, 04:09 AM
  2. Looping through a multidimensional array
    By MysticDeath in forum Loops & Control Statements
    Replies: 2
    Last Post: October 11th, 2009, 05:41 PM
  3. Storing an array into an array
    By vluong in forum Collections and Generics
    Replies: 4
    Last Post: September 22nd, 2009, 02:14 PM