import java.util.Scanner;
import java.util.Arrays;

public class project {


private static Scanner keyboard = new Scanner(System.in);

public static void main() {
double row [][];
int positionInRow, numberInRow, rowSize, index, numberOfRows,weight;
int maxWeight = 100; 

System.out.println("Welcome to the Band of the Hour");
System.out.println("-------------------------------");
System.out.print("Please enter number of rows : ");

numberOfRows = keyboard.nextInt();
row = new double [numberOfRows][];
//int[][] weirdData = new int[3][];

//Add number of positions
for (index = 0; index < row.length; index++) {
    System.out.print("Please enter number of positions in row " + (char)((int) 'A' + index) + ":");
    rowSize = keyboard.nextInt();
    row [index] = new double [rowSize];

//  weirdData[0] = new int[5];
//  weirdData[1] = new int[4];
//  weirdData[2] = new int[7];


    for(positionInRow = 0; positionInRow < row.length; positionInRow++){
        row[index][positionInRow]= 0.0;
        }
displayMenu (row);
    }
}
//function for displaying menu to the user
private static void displayMenu (double[][] row) {
char command;
    do {
        System.out.println("(A)dd, (R)emove, (P)rint, e(X)it (Not case sensitive):  ");
        command = keyboard.nextLine().charAt(0);

        switch (command){

            case 'A':
            case 'a':
                addMusician(row);

                break;

            case 'R':
            case 'r':
                removeMusician(row);
                break;

            case 'P':
            case 'p':
                printBandstand(row);
                break;

            case 'X':
            case 'x':
                System.out.println("Thank you for using my program!");
                break;

            default:
            System.out.println("ERROR: Invalid option, enter an acceptable value :");
    }
} 
    while 
            (command != 'X' && command != 'x');

}
//method for adding musician to a position
private static void addMusician(double[][] row)

}


//method for removing musician from a position
private static void removeMusician(double[][] row) 


//method for printing the entire bandstand       
private static void printBandstand(double[][] row) 




}

Recommended Answers

All 12 Replies

Sorry !!! I fogrgot to place the information with the code!!!!

I am having some trouble actually getting this done. I believe I have it correct so far. I just dont know how I am going to add the members in the arrays as well as removing them. I also can't figure out if I try to place a member in a space of the array that already has a member it outputs a println like "Sorry, please select another position. A member is already here". The sample output is below to show what I would need it to have. Yes, this is a project for school and I i'm not saying I need the exact code ( Read: do it for me), I would just need a little nudge in right direction. Please let me know if the code I have started to write is wrong already... Thank you for the help in advance!

The number of rows they have to stand on. The maximum number of rows is 10. The rows are labelled with capital letters, 'A', 'B', 'C', etc.
For each row, the number of positions in the row. The maximum number of positions is 8. The positions are numbered with integers, 1, 2, 3, etc.
The conductor then starts assigning people to positions, but is constrained by weight limits: Musicians, fully clothed and holding their instruments, weigh from 45kg to 200kg, and the total weight of a row may not exceed 100kg per position (e.g., a row with 5 positions may not have more than 500kg of musicians on it). The conductor wants a program that allows musicians to be added and removed from positions, while ensuring the constraints are all met. At any stage the conductor wants to be able to see the current assignment - the weight in each position (0kg for vacant positions) and the total & average weight for each row.
The program must be menu driven, with options to:

Add a musician (by weight) to a vacant position.
Remove a musician from an occupied position.
Print the current assignment.
Exit (so the musicians can start playing)
---------------------------------------------------
The program must be reasonably idiot proof:
Menu options must be accepted in upper and lower case.
Row letters must be accepted in upper and lower case.
All input must be checked to be in range, and if not the user must be asked to input again.
You may assume that numeric input will be syntactically correct.

---------------------------------------------------
Example of the output :

[code]
Welcome to the Band of the Hour
-------------------------------

ERROR: Out of range, try again            : 3
Please enter number of positions in row A : -4
ERROR: Out of range, try again            : 3
Please enter number of positions in row B : 4
Please enter number of positions in row C : 5

(A)dd, (R)emove, (P)rint,          e(X)it : p

A:   0.0   0.0   0.0                                [    0.0,     0.0]
B:   0.0   0.0   0.0   0.0                          [    0.0,     0.0]
C:   0.0   0.0   0.0   0.0   0.0                    [    0.0,     0.0]

(A)dd, (R)emove, (P)rint,          e(X)it : a
Please enter row letter                   : Q
ERROR: Out of range, try again            : B
Please enter position number (1 to 4)     : 6
ERROR: Out of range, try again            : 1
Please enter weight (45.0 to 200.0)       : 22
ERROR: Out of range, try again            : 222
ERROR: Out of range, try again            : 180
****** Musician added.

(A)dd, (R)emove, (P)rint,          e(X)it : p

A:   0.0   0.0   0.0                                [    0.0,     0.0]
B: 180.0   0.0   0.0   0.0                          [  180.0,    45.0]
C:   0.0   0.0   0.0   0.0   0.0                    [    0.0,     0.0]

(A)dd, (R)emove, (P)rint,          e(X)it : A
Please enter row letter                   : b
Please enter position number (1 to 4)     : 1
ERROR: There is already a musician there.

(A)dd, (R)emove, (P)rint,          e(X)it : A
Please enter row letter                   : B
Please enter position number (1 to 4)     : 2
Please enter weight (45.0 to 200.0)       : 150
****** Musician added.

(A)dd, (R)emove, (P)rint,          e(X)it : p

A:   0.0   0.0   0.0                                [    0.0,     0.0]
B: 180.0 150.0   0.0   0.0                          [  330.0,    82.5]
C:   0.0   0.0   0.0   0.0   0.0                    [    0.0,     0.0]

(A)dd, (R)emove, (P)rint,          e(X)it : a
Please enter row letter                   : b
Please enter position number (1 to 4)     : 3
Please enter weight (45.0 to 200.0)       : 175
ERROR: That would exceed the average weight limit.

(A)dd, (R)emove, (P)rint,          e(X)it : a
Please enter row letter                   : b
Please enter position number (1 to 4)     : 4
Please enter weight (45.0 to 200.0)       : 55
****** Musician added.

(A)dd, (R)emove, (P)rint,          e(X)it : p

A:   0.0   0.0   0.0                                [    0.0,     0.0]
B: 180.0 150.0   0.0  55.0                          [  385.0,    96.3]
C:   0.0   0.0   0.0   0.0   0.0                    [    0.0,     0.0]

(A)dd, (R)emove, (P)rint,          e(X)it : r
Please enter row letter                   : b
Please enter position number (1 to 4)     : 3
ERROR: That position is vacant.

(A)dd, (R)emove, (P)rint,          e(X)it : r
Please enter row letter                   : b
Please enter position number (1 to 4)     : 1
****** Musician removed.

(A)dd, (R)emove, (P)rint,          e(X)it : p

A:   0.0   0.0   0.0                                [    0.0,     0.0]
B:   0.0 150.0   0.0  55.0                          [  205.0,    51.3]
C:   0.0   0.0   0.0   0.0   0.0                    [    0.0,     0.0]

(A)dd, (R)emove, (P)rint,          e(X)it : q
ERROR: Invalid option, try again          : P

A:   0.0   0.0   0.0                                [    0.0,     0.0]
B:   0.0 150.0   0.0  55.0                          [  205.0,    51.3]
C:   0.0   0.0   0.0   0.0   0.0                    [    0.0,     0.0]

(A)dd, (R)emove, (P)rint,          e(X)it : X

You have a 2d array (rows / positions). All its entries will initially be zero. When you place a musician you put their weight into the corresponding entry. So it's really easy to see if a position is empty (the entry is still zero) or occupied (the entry is a non-zero weight). And to remove a musician just set the entry back to zero.

So when the program says " There is already a musician here" would it be something like an if statement if an index value is greater than 0 than print "There is already a musician here"? I am just super confused on how to make it say that if I already placed a value there.

Edit: I appreciate the help! Also my different methods on the bottom I don't know how to go about coding them. This is just so frustrating for me! I have tried looking it up in the search function on this site as well as others and I just to get how I am going to select a certain position to add it to.

Example:

(A)dd, (R)emove, (P)rint, e(X)it : a
Please enter row letter : b
Please enter position number (1 to 4) : 4
Please enter weight (45.0 to 200.0) : 55
****** Musician added.

It really is that simple, eg let's suppose the2D array is called weights, then if the user asks if row B, position 4 is occupied, your test is

if (weights[1][3] > 0)

(remember Java arrays start at element 0, not element 1)

Thank you for the help so far. I will try to finish up a bit more code and get something more complete to look at. This is a final project for a beginners java class. The teacher is not very informative when describing things so I have to resort to self teaching to try to get through this class. My TA is horrible and is no help...

Did you have a chance to look at my code so far? Just wondering if Im going good so far on it. I have not tried to run anything because I don't have the program complete yet. I am not trying to be a bother at all, I really don't have anyone else to look it over.

Sorry, I'm out now until tomorrow. Do try to run your code - the sooner you run it the sooner yo will find the bugs. Just hard-code values for anything that you need but haven't sorted yet. Trust me, real programmers test early and test often.
See you tomorrow.
J

Still working on this. Please any help in any of the things i have commented below would help me out greatly. I dont need the exact code written out for me . I am not looking for anyone just flat out do my work, I just need maybe a hint in some places. I have really tried hard and I seem to be getting no where further to asnwer some of my questions. If anyone has the time to look through my current code and give suggestions or/and help with adding onto my program, I would appreciate it greatly, I will try to soak in the information as well as a sponge. Thans in advance!

(Original assignment is shown above, yes this is for class)

import java.util.Scanner;


public class project {
    private static int rowSelect;
    private static int positionRow;
    private static int rowSize;
    private static double musicianWeight;

    int totalWeight;

private static Scanner keyboard = new Scanner(System.in);

public static void main() {
double[][] row ;
double average, total,weight;
double MAX_ROW_WEIGHT = 0.0; 
int positionInRow, index, numberOfRows;

System.out.println("Welcome to the Band of the Hour");
System.out.println("-------------------------------");
System.out.print("Please enter number of rows : ");

numberOfRows = keyboard.nextInt();
row = new double [numberOfRows][];



//Add number of positions
for (index = 0; index < row.length; index++) {
    System.out.print("Please enter number of positions in row " + (char)((int) 'A' + index) + ":");
    rowSize = keyboard.nextInt();
    row [index] = new double [rowSize];


    for(positionInRow = 0; positionInRow < row.length; positionInRow++){
        row[index][positionInRow]= 0.0;
        }
displayMenu (row);
    }
}
//function for displaying menu to the user
private static void displayMenu (double[][] row) {
char command;
    do {
        System.out.println("(A)dd, (R)emove, (P)rint, e(X)it (Not case sensitive):  ");
        command = keyboard.nextLine().charAt(0);

        switch (command){

            case 'A'|'a':
            addMusician(row);
            break;

            case 'R'|'r':
            removeMusician(row);
            break;

            case 'P'|'p':
            printBandstand(row);
            break;

            case 'X'|'x':
            System.out.println("Thank you for using my program!");
            break;

            default:
            System.out.println("ERROR: Invalid option, enter an acceptable value :");
    }
} 
    while 
            (command != 'X'); 

}
//method for adding musician to a position
private static void weightLeftToUse(  ){

        //show total weight left to be used in the row. add array [][] subtract from numberOfRows*100
        //function  (rowSize * 100) - totalWeight
}



private static void addMusician(double[][] row){
 double MAX_WEIGHT = 200.0;
 double MIN_WEIGHT = 45.0;
    System.out.println("Please select Row to ADD musician: ");
    rowSelect = keyboard. nextInt();

    if (rowSelect > 10 | rowSelect < 0)
        System.out.println("Error, please enter a valid row ");

        else 
            System.out.println("Please enter position in row to ADD musician: ");
            positionRow = keyboard.nextInt();
            //I want to display the amount of positions in the row next to this question (1-?)
            // it would be "Active" displaying whatever the user inputed as the total number of spaces in this row.
            //This will help the user know how many positions are in the row,
            //instead of selecting something that doesnt work
    if (positionRow < rowSize){
        System.out.println("Please enter weight of musician: ");
        musicianWeight = keyboard.nextDouble();

        //I want to check if musicianWeight is below and above the min and max
        //weight allowed, before adding it
        //add user weight to the postion 

        System.out.println("*****Musician Added*****");
    }
        else 
            System.out.println("Invalid position");

            //I also want to make sure that the position in the array is empty (0.0).
            //I dont want to overwrite a value,just add to only blank spaces. 
            // I want to keep a running total of the current weight in the numeric portion of the 2nd array,
            //I want to display that total alongside "Please enter weight of musician  (currentweight in the array)"
            //This would be important so the user knows how much more they can add before reachhing the limit












}


//method for removing musician from a position
private static void removeMusician(double[][] row){



    System.out.println("Please select Row to REMOVE musician: ");
    rowSelect = keyboard. nextInt();

    if (rowSelect > 10 | rowSelect < 0){
        System.out.println("Error, please enter a valid row ");
    }
    else 
        //select row to begin removing musician  
    System.out.println("Please enter POSITION in row to REMOVE musician: ");
    positionRow = keyboard.nextInt();


    if (positionRow <= rowSize){
        //must make the array position 0.0
        double[rowSelect][positionRow] = 0.0; //getting error to remname the local variable.
           // I need all of this to keep looping until a valid position is entered. 
        }
    else {

            System.out.println(" Error, please enter a valid position in row!");
        }


}




//method for printing the entire bandstand       
private static void printBandstand(double[][] row){
    System.out.println("Band Chart");
    System.out.println("------------");
//println all code needed to output the array 
//print average + total of the weight in each array position (Average, total)
    System.out.println("¸.•*¨*•♫♪¸¸.•*¨*•♫♪¸¸.•*¨*•♫♪¸¸.•*¨*•♫♪¸¸¸.•*¨*•♫♪");





} //reaching end of file while parsing error, just saying...

My comments in the program are my areas of concerns. Any help would greatly be appreicated! Yes, this is for school and I have sat here for about 6 hours and I have totally lost myself on this one. I just cant keep up with it. If possible, please help

import java.util.Scanner;


public class project {
    private static int rowSelect;
    private static int positionRow;
    private static int rowSize;
    private static double musicianWeight;

    int totalWeight;

private static Scanner keyboard = new Scanner(System.in);

public static void main() {
double[][] row ;
double average, total,weight;
double MAX_ROW_WEIGHT = 0.0; 
int positionInRow, index, numberOfRows;

System.out.println("Welcome to the Band of the Hour");
System.out.println("-------------------------------");
System.out.print("Please enter number of rows : ");

numberOfRows = keyboard.nextInt();
row = new double [numberOfRows][];



//Add number of positions
for (index = 0; index < row.length; index++) {
    System.out.print("Please enter number of positions in row " + (char)((int) 'A' + index) + ":");
    rowSize = keyboard.nextInt();
    row [index] = new double [rowSize];


    for(positionInRow = 0; positionInRow < row.length; positionInRow++){
        row[index][positionInRow]= 0.0;
        }
displayMenu (row);
    }
}
//function for displaying menu to the user
private static void displayMenu (double[][] row) {
char command;
    do {
        System.out.println("(A)dd, (R)emove, (P)rint, e(X)it (Not case sensitive):  ");
        command = keyboard.nextLine().charAt(0);

        switch (command){

            case 'A'|'a':
            addMusician(row);
            break;

            case 'R'|'r':
            removeMusician(row);
            break;

            case 'P'|'p':
            printBandstand(row);
            break;

            case 'X'|'x':
            System.out.println("Thank you for using my program!");
            break;

            default:
            System.out.println("ERROR: Invalid option, enter an acceptable value :");
    }
} 
    while 
            (command != 'X'); 

}



private static void addMusician(double[][] row){
 double MAX_WEIGHT = 200.0;
 double MIN_WEIGHT = 45.0;
    System.out.println("Please select Row to ADD musician: ");
    rowSelect = keyboard. nextInt();

    if (rowSelect > 10 | rowSelect < 0)
        System.out.println("Error, please enter a valid row ");

        else 
            System.out.println("Please enter position in row to ADD musician: ");
            positionRow = keyboard.nextInt();
            //I want to display the amount of positions in the row next to this question (1-?)
            // it would be "Active" displaying whatever the user inputed as the total number of spaces in this row.
            //This will help the user know how many positions are in the row,
            //instead of selecting something that doesnt work
    if (positionRow < rowSize){
        System.out.println("Please enter weight of musician: ");
        musicianWeight = keyboard.nextDouble();

        //I want to check if musicianWeight is below and above the min and max
        //weight allowed, before adding it
        //add user weight to the postion 

        System.out.println("*****Musician Added*****");
    }
        else 
            System.out.println("Invalid position");

            //I also want to make sure that the position in the array is empty (0.0).
            //I dont want to overwrite a value,just add to only blank spaces. 
            // I want to keep a running total of the current weight in the numeric portion of the 2nd array,
            //I want to display that total alongside "Please enter weight of musician  (currentweight in the array)"
            //This would be important so the user knows how much more they can add before reachhing the limit


}
//method for removing musician from a position
private static void removeMusician(double[][] row){



    System.out.println("Please select Row to REMOVE musician: ");
    rowSelect = keyboard. nextInt();

    if (rowSelect > 10 | rowSelect < 0){
        System.out.println("Error, please enter a valid row ");
    }
    else 
        //select row to begin removing musician  
    System.out.println("Please enter POSITION in row to REMOVE musician: ");
    positionRow = keyboard.nextInt();


    if (positionRow <= rowSize){
        //must make the array position 0.0
        double[rowSelect][positionRow] = 0.0; //getting error to remname the local variable.
           // I need all of this to keep looping until a valid position is entered. 
        }
    else {

            System.out.println(" Error, please enter a valid position in row!");
        }


}




//method for printing the entire bandstand       
private static void printBandstand(double[][] row){
    System.out.println("Band Chart");
    System.out.println("------------");
//println all code needed to output the array 
//print average + total of the weight in each array position (Average, total)
    System.out.println("¸.•*¨*•♫♪¸¸.•*¨*•♫♪¸¸.•*¨*•♫♪¸¸.•*¨*•♫♪¸¸¸.•*¨*•♫♪");





} //reaching end of file while parsing error, just saying...

If anyone cares to see my final project completed I have decided to update it in case anyone would like to go over it or possibly learn from it. It took me a while but I worked my way through it. Any input about the way I did it would be great to help me improve anthing. Thanks.

package athinaband;

import java.util.Scanner;



public class Athinaband {
    final static double MAX_WEIGHT = 200.0;
    final static double MIN_WEIGHT = 45.0;
    final static double MAX_WEIGHT_PER_POSITION = 100;
    private static Scanner keyboard = new Scanner(System. in );

    public static void main(String[] args)  {
        double[][] row;

        int positionInRow, index, numberOfRows, rowSize;

        System.out.println("WELCOME TO THE 'BAND OF THE HOUR PROGRAM' !");
        System.out.println("    -------------------------------");
        System.out.println("            ♪ ♫ ╔═══╗ ♪ ♫");
        System.out.println("           ♫♪ ♫ ║███║ ♫♪ ♫");
        System.out.println("                ║(●)║");
        System.out.println("                ╚═══╝");
        System.out.println("    -------------------------------");
        System.out.print("Please enter number of rows (1-10):");

        numberOfRows = keyboard.nextInt(); 

        while (numberOfRows < 1 || numberOfRows > 10 )
        { 
            System.out.print("Error, the number of rows must be between 1-10!");
            System.out.println("______________________________________________");
            System.out.print("Please enter number of rows : ");
            numberOfRows = keyboard.nextInt();
        }

        row = new double[numberOfRows][]; 
        System.out.println("-------------------------------------------------");
        System.out.println("Values for the amount of positions in the row must be between 1-8");
        System.out.println("-------------------------------------------------");
        //Add number of positions
        for (index = 0; index < numberOfRows; index++) {
            System.out.print("Please enter number of positions in row " + (char)((int)
                'A' + index) + ":");
            rowSize = keyboard.nextInt();

            //checks rowSize is within the parameters  
            while (rowSize < 1 || rowSize > 8)
            {
                System.out.println("Error, please select a value from 1-8!");
                System.out.println("______________________________________________");
                System.out.print("Please enter number of positions in row " + (char)((int)
                'A' + index) + ":");
            rowSize = keyboard.nextInt();
            }
            row[index] = new double[rowSize];
            //sets all array values to 0.0
            for (positionInRow = 0; positionInRow < rowSize; positionInRow++) {
                row[index][positionInRow] = 0.0;
            }
        }

        displayMenu(row);

        keyboard.close();
    }

    private static void displayMenu(double[][] row) {
            keyboard.nextLine();        
            char command;
            do {
                System.out.println(" ");
                System.out.print("(A)dd, (R)emove, (P)rint, e(X)it (Not case sensitive):  ");

                command = keyboard.next().charAt(0); 

                switch (command) {

                case 'A':
                case 'a':
                    addMusician(row);
                    break;

                case 'R':
                case 'r':
                    removeMusician(row);
                    break;

                case 'P':  
                case 'p':
                    printBandstand(row);
                    break;

                case 'X':
                case 'x':
                    System.out.println(" ");
                    System.out.println("¸.•*¨*•♫♪¸¸.•*¨*•♫♪¸Enjoy The Music¸.•*¨*•♫♪¸¸.•*¨*•♫♪¸¸¸.•*¨*•♫♪");
                    break;

                default:
                    System.out.println("ERROR: Invalid option");
                    System.out.println("______________________________________________");
                }
            }
            while (command != 'x');

        }

    private static void addMusician(double[][] row) {
            int rowSelect, positionRow;
            double musicianWeight;
            int rowSize = 0;

            System.out.print("Please select row letter to ADD musician: ");
            String temp = keyboard.next().toUpperCase();
            rowSelect = temp.charAt(0) - 65;

            while (rowSelect < 0 || rowSelect > row.length -1)
            {
                System.out.println("Error, please enter a valid row ");
                System.out.println("______________________________________________");
                System.out.print("Please select row letter to ADD musician: ");
                temp = keyboard.next().toUpperCase();
                rowSelect = temp.charAt(0) - 65;
            }


            System.out.print("Please enter position in row to ADD musician(1-"+row[rowSelect].length+"):");
            positionRow = keyboard.nextInt();

            while (positionRow < 1 || positionRow > row[rowSelect].length) {
                System.out.println("Error, enter correct position in row");
                System.out.println("______________________________________________");
                System.out.print("Please enter position in row to ADD musician(1-"+row[rowSelect].length+"):");
                positionRow = keyboard.nextInt();

            }
            if (row[rowSelect][positionRow - 1] != 0.0)
            {
                System.out.println("There is already a musician here");
                return;
            }

            double weightLeft = getRowWeightLeft(row, rowSelect);
            System.out.println(" ");
            System.out.println("Weight remaining for this row is " + weightLeft + "kg");
            System.out.print("Please enter weight of musician: ");
            musicianWeight = keyboard.nextDouble();

            while (musicianWeight > MAX_WEIGHT || musicianWeight < MIN_WEIGHT) {
                System.out.println("Error, please enter a valid weight (45Kg-200kg)!");
                System.out.println("______________________________________________");
                System.out.print("Please enter weight of musician: ");
                musicianWeight = keyboard.nextDouble();

            }
            if (musicianWeight > weightLeft) {
                System.out.println("Error, adding this musician would exceed the maximum allowed weight for this row");
                return;
            }

            row[rowSelect][positionRow - 1] = musicianWeight;
            System.out.println("*****Musician Added*****");

        }

    private static void removeMusician(double[][] row) {
            int rowSelect, positionRow;

            System.out.print("Please select row letter to REMOVE musician: ");
            String temp = keyboard.next().toUpperCase();
            rowSelect = temp.charAt(0) - 65;

            while (rowSelect < 0 || rowSelect > row.length -1)
            {
                System.out.println("Error, please enter a valid row ");
                System.out.println("______________________________________________");
                System.out.print("Please select row letter to REMOVE musician: ");
                temp = keyboard.next().toUpperCase();
                rowSelect = temp.charAt(0) - 65;
            }


            System.out.print("Please enter position in row to REMOVE musician(1-"+row[rowSelect].length+"):");
            positionRow = keyboard.nextInt();

            while (positionRow < 1 || positionRow > row[rowSelect].length) {
                System.out.println("Error, enter correct position in row");
                System.out.println("______________________________________________");
                System.out.print("Please enter position in row to REMOVE musician(1-"+row[rowSelect].length+"):");
                positionRow = keyboard.nextInt();

            }

            if (row[rowSelect][positionRow - 1] == 0.0)
            {
                System.out.println("There is no musician here to remove!");
                return;
            }


                row[rowSelect][positionRow - 1] = 0.0;
                System.out.println("*****Musician REMOVED*****");

        }


        private static void printBandstand(double[][] row)
        {
            int maxLength = 0;

            for (int i = 0; i < row.length; i++) {
                if (row[i].length > maxLength)
                    maxLength = row[i].length;
            }

            for (int i = 0; i < row.length; i++)
            {
                System.out.print((char)(i+65) + ":\t");

                double arrayTotal = 0;
                for(int j = 0; j < row[i].length; j++)
                {
                    arrayTotal += row[i][j];  
                    System.out.printf("%4.1f\t", row[i][j]);
                }

                for (int j = 0; j < (maxLength - row[i].length); j++) 
                    System.out.print("\t");

                System.out.printf("[ %3.1f, %3.1f]%n", arrayTotal, (arrayTotal/row[i].length));
            }
        }

        private static double getRowWeightLeft(double[][] row, int rowSelect) {
            double currentTotal = 0.0;
            double allowedTotal = row[rowSelect].length * MAX_WEIGHT_PER_POSITION;

            for (int i = 0; i < row[rowSelect].length; i++) {
                currentTotal += row[rowSelect][i];
            }

            return (allowedTotal - currentTotal);
        }
}
commented: Very Good!! :) +2

Thanks for sharing your final solution. I had a quick scan thru the code and can't see anything objectionable, so well done. (Rather than static methods I would generally prefer to see an instance-based implemention, but in this case it really doesn't matter.)

This was the only problem I found:-

For exiting the program, the command is not case sensitive. When I press 'X' it does not exits the program it just breaks the loop and continues. So check the condition of the do while loop in displayMenu method.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.