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 15 of 15

Thread: need help with my program, not clear on diagonals or methods 3, 4 & 6 logic

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default need help with my program, not clear on diagonals or methods 3, 4 & 6 logic

    import java.util.Scanner;
     
    /**
     * Grid class
     *
     * Layout of Grid [0] [1] [2] ... [0] [1] [2]
     *
     */
    public class Grid {
     
        private static final int ROWS = 6;
        private static final int COLS = 7;
        private char board[][];
     
        /**
         * METHOD 1 construct the game grid initialize each cell to the ""
         */
        public Grid() {
            //2D array to use as grid
            board = new char[ROWS][COLS];
            // For Loops that assign an * to each array cell
            for (int i = 0; i < board.length; i++) {
                for (int j = 0; j < board[i].length; j++) {
                    board[i][j] = '*';
                }
            }
        }
     
        /**
         * METHOD 2  check for fullBoard
         *
         * @return true if board is full, false otherwise *
         */
        private boolean fullBoard() {
     
            //variable to hold value for a full board
            boolean full = false;
     
            for (int i = 0; i < board.length; i++) {
                for (int j = 0; j < board[i].length; j++) {
                    if (board[i][j] != '*') {
                        full = true;
                    }
                }
            }
            return full;
     
        }
     
        /**
         * METHOD 3 
         *
         * @param col
         * @return true if col is on the grid
         */
        private boolean isColValid(int col) {
            boolean valid = false;
     
     
            return valid;
     
        }
     
        /**
         * METHOD 4 (10%)
         *
         * @param column
         * @return "first" unoccupied cell in column return -1 if there is no
         * unoccupied cell in this row
         */
        private int firstEmpty(int column) {
            return -1;
        }
     
        /**
         * METHOD 5 (15%) display the board
         */
        private void showBoard() {
     
            for (int i = 0; i < board.length; i++) {
                for (int j = 0; j < board[i].length; j++) {
                    System.out.print(board[i][j] + " ");
     
                }
                System.out.println("");
            }
        }
     
        /**
         * METHOD 6 check board for a win
         *
         * @return true if there is a row, col, or diagonal of 4 matching colors
         * false otherwise
         */
        private boolean checkForWin() {
            boolean win = false;
     
            //Check by row
     
            for (int i = 0; i < board.length; i++) {
                for (int j = 0; j < board[i].length - 4; j++) {
                    if (board[i][j] == board[i][j + 1]
                            && board[i][j + 1] == board[i][j + 2]
                            && board[i][j + 2] == board[i][j + 3]) {
                        while (board[i][j] != '*') {
                            win = true;
                        }
     
                    }
                }
     
            }
     
     
            //Check by column
     
            for (int i = 0; i < COLS; i++) 
            {
                for (int j = 0; j <= ROWS - 3; j++) 
                {
                    if (board[i][j] == board[i + 1][j]
                            && board[i + 1][j] == board[i + 2][j]
                            && board[i + 2][j] == board[i + 3][j]) 
                    {
     
                        while (board[i][j] != '*') 
                        {
                            win = true;
                        }
                    }
     
                }
            }
     
            // Check Diagonally bottom left to top right
     
     
     
            return win;
     
        }
     
        /**
         * GIVEN
         *
         * @return true if there is a win or if the board is full
         */
        private boolean gameOver() {
            //game is over if there is a win or the board is full
            return this.checkForWin() || fullBoard();
        }
     
        /**
         * GIVEN
         *
         * @param column
         * @param color place color in first unoccupied row in this column (update
         * cell from '*' to color)
         * @return true if the play is successful, false if color cannot be placed
         * in this column
         */
        private boolean play(int column, char color) {
            //if the column is not valid, return false
            if (!this.isColValid(column)) {
                return false;
            }
            //find the first empty row in this column
            int row = firstEmpty(column);
     
            //see if column is full
            if (row < 0) {
                return false;
            }
            //else, set the cell to this color
            board[row][column] = color;
            return true;
        }
     
        /**
         * GIVEN driver method that controls game play
         *
         * @return when game is over, i.e. if win or if board is full (no "" in
         * cells)
         *
         */
        public void playGame() {
     
            do {
                //show the board
                this.showBoard();
                //ask user for a column and color
                System.out.print("Enter column (0 - 6) and "
                        + "color (red or black):  ");
                Scanner kybd = new Scanner(System.in);
                int col = kybd.nextInt();
                String color = kybd.next();
                //play it
                this.play(col, color.charAt(0));
            } while (!this.gameOver());
        }
    }


  2. #2
    Junior Member
    Join Date
    Aug 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: need help with my program, not clear on diagonals or methods 3, 4 & 6 logic

    Sorry it is a connect four game using 2d arrays as the grid

  3. #3
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: need help with my program, not clear on diagonals or methods 3, 4 & 6 logic

    Can you explain your problem in greater detail so that we might better understand just what is not working? My experience has been the better the question, usually the better the answer.

  4. #4
    Junior Member
    Join Date
    Aug 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: need help with my program, not clear on diagonals or methods 3, 4 & 6 logic

    In the isColValid method I have to return true if a column falls on the Grid and false otherwise. IN the firstEmpty method I have to return the row of the first empty cell or -1 if there is no empty row in this column. When checking for a win im not sure how to do the diagonals and on the rows and columns im not sure how to logically express the indices cannot == '*' for a win.

  5. #5
    Member
    Join Date
    Jun 2012
    Location
    Left Coast, USA
    Posts
    451
    My Mood
    Mellow
    Thanks
    1
    Thanked 97 Times in 88 Posts

    Default Re: need help with my program, not clear on diagonals or methods 3, 4 & 6 logic

    Quote Originally Posted by wayfaring_stranger View Post
    In the isColValid method I have to return true if a column falls on the Grid and false otherwise. IN the firstEmpty method I have to return the row of the first empty cell or -1 if there is no empty row in this column. When checking for a win im not sure how to do the diagonals and on the rows and columns im not sure how to logically express the indices cannot == '*' for a win.
    Here's a way to get started with the program code that is already in place:

    Create a very simple main() function that looks like this:
        public static void main(String [] args) {
            Grid board = new Grid();
            board.showBoard();
            board.play(3,'B');
            board.showBoard();
        }

    See? For starters just make sure that you can show the board and make a simple move and show the board again. Don't worry about actually playing a game. Just make sure you can make a move and see its effect on the state of the board.

    Now, what would you expect to see after this single move?

    Maybe something like
    * * * * * * * 
    * * * * * * * 
    * * * * * * * 
    * * * * * * * 
    * * * * * * * 
    * * * B * * *


    If you don't see this, then trace through the code and see where it is going wrong. Look carefully at the code, and if you aren't sure what it is doing, make the program tell you. (Put print statements that tell the values of arguments at the beginning of functions that are called and put print statements that show what the function is going to return. Stuff like that.)

    Quote Originally Posted by wayfaring_stranger View Post
    In the isColValid method I have to return true if a column falls on the Grid and false otherwise.
    So, you have a 2D array whose size is ROWS x COLS, right? How do you tell whether a column number (the value entered by the user) is valid? Well if it is less than zero or greater than or equal to COLS, it's invalid, right? So make the function return "true" or "false" depending on whether the value of the argument is in the proper range. If the user tries a column that is not valid, the program will (eventually) have to ask the user for another value. (Don't worry about that part yet, just make sure it can make a valid move and then change the hard-coded move with a column value that is less than zero or greater than the maximum allowable column number and see that it rejects that.)

    Go on to the next function that you need: firstEmpty. Looking at the way that you are printing the array, I perceive that the top row is number zero, and the bottom is row number ROWS-1, right?

    Furthermore...

    You have initialized the array so that all values are '*' and if a previous move has resulted in a character that is not '*' in a particular row and column, you can't put anything else there, right?

    So...

    For a given column, you start looking at the bottom row and work your way back up, checking board[row][column] for the given column to see if it is equal to '*' If you find a row for which the board's value is not '*', then that is the first valid place on in that column, so you return that row value. If you get all of the way to the top row (row == 0) without finding a '*' you know that a move for that column is invalid, so you return -1.

    And so it goes...

    Bottom line: Start with a single play hard-coded into the main() program. Try a couple of different columns.
    Then hard-code six or seven moves to the same column and see what happens. By hard-coding a few plays in main() you can run it over and over and over again without having to enter user plays from the terminal. This is important for preliminary debugging. I mean I can't speak for you, but in my experience, I might have to run it a lot of times (a whole lot) before getting the first parts in place, and having to enter six or seven moves manually each run is just too, too tedious.

    Once you get past that point chip away at the other issues...

    If you get stuck at a particular point, post the code that you have implemented so far and ask specific questions.


    Cheers!

    Z
    Last edited by Zaphod_b; August 30th, 2012 at 07:32 PM.

  6. #6
    Junior Member
    Join Date
    Aug 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: need help with my program, not clear on diagonals or methods 3, 4 & 6 logic

    private int firstEmpty(int column) {
     
            for( int i = column; i <= column; i++) 
            {
                for(int j = 0; j <= ROWS-1; j++) 
                {
                    if(board[ROWS][column]=='*') 
                     {
                        return ROWS;
                     }
     
     
               }
            }
             return -1;
        }


    would this check each row(starting at the bottom) for the user given column?

  7. #7
    Member
    Join Date
    Jun 2012
    Location
    Left Coast, USA
    Posts
    451
    My Mood
    Mellow
    Thanks
    1
    Thanked 97 Times in 88 Posts

    Default Re: need help with my program, not clear on diagonals or methods 3, 4 & 6 logic

    Quote Originally Posted by wayfaring_stranger
    would this check each row(starting at the bottom) for the user given column?
    No.

    Think about it. I mean, really think about it. Then look at your code again. Then don't look at the code again, but think of a process that will do the deed:

    Maybe something like this.

    The column number is fixed (it is a parameter of the function), so you only need need one loop (for the row number).

    The bottom row is numbered ROWS-1, so that's the first thing you check. (In other words, initialize the loop counter to ROWS-1). You will decrement the loop counter (the row number) each time through the loop, and will exit the loop "normally" if the loop counter ever gets to a value that is not >= 0.

    Now...

    Inside the loop, look at the current [row][column] value and see if it is '*'. If it is '*', then the value of the row counter is what you want to return. You can return that value without having to go through the loop any more.

    However...

    If the current element is not '*', then you haven't found an unoccupied cell yet, so the row counter is decremented, and it goes through the loop again.

    If it gets all of the way to the top row without finding a '*', (leaves the loop "normally") that means that all of the rows of that column are occupied, so return -1.


    Cheers!

    Z
    Last edited by Zaphod_b; September 5th, 2012 at 01:40 PM.

  8. #8
    Junior Member
    Join Date
    Aug 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: need help with my program, not clear on diagonals or methods 3, 4 & 6 logic

    Ok I got some help from my schools lab tutor about the check for empty. Now I am getting an Array out of bounds error in my checkForWin method I have been through it a hundred times and can't figure it out.

      private boolean checkForWin() {
            //variable to hold boolean value
            boolean win = false;
     
     
            //Check for a win by row
     
     
            for (int i = 0; i < ROWS; i++) 
            {
                for (int j = 0; j <= COLS - 4; j++) 
                {
                    if (board[i][j] == board[i][j + 1]
                            && board[i][j + 1] == board[i][j + 2]
                            && board[i][j + 2] == board[i][j + 3]) 
                    {
                        if (board[i][j] != '*') 
                        {
                            win = true;
                        }
     
     
     
                    }
                }
     
     
            }
     
     
     
     
            //Check for a win by column
     
     
            for (int i = 0; i < COLS; i++)
            {
                for (int j = 0; j <= ROWS - 3; j++)
                {
                    if (board[i][j] == board[i + 1][j]
                            && board[i + 1][j] == board[i + 2][j]
                            && board[i + 2][j] == board[i + 3][j])
                    {
     
     
                       if (board[i][j] != '*')
                        {
                            win = true;
     
                    }
     
     
                }
              }
            }
     
     
            // Check for a win diagonally bottom left to top right
     
                for(int i = ROWS-1; i<= ROWS-4; i--)
                {
                    for(int j = 0; j< COLS-3;j++)
                    {
                        if(board[i][j]== board[i-1][j+1]
                        && board[i-1][j+1]== board[i-2][j+2]
                        && board[i-2][j+2]== board[i-3][j+3])
                        {
                         if(board[i][j]=='b'||board[i][j]=='r')
                         {
                             win = true;
                         }  
                        }
                    }
                }
     
                //check for a win diagonally from top left to bottom right
     
                for(int i = 0; i<ROWS-3;i++)
                {
                    for(int j=0; j<COLS-3;j++)
                    {
                        if(board[i][j]==board[i+1][j+1]
                        && board [i+1][j+1]==board[i+2][j+2]
                        && board [i+2][j+2] == board [i+3][j+3])
                        {
                            if (board[i][j]=='b' || board[i][j]=='r')
                            {
                                win = true;
                            }
                        }
                    }
                }
     
            return win;
     
     
        }
    Last edited by wayfaring_stranger; September 5th, 2012 at 07:28 PM.

  9. #9
    Member
    Join Date
    Jun 2012
    Location
    Left Coast, USA
    Posts
    451
    My Mood
    Mellow
    Thanks
    1
    Thanked 97 Times in 88 Posts

    Default Re: need help with my program, not clear on diagonals or methods 3, 4 & 6 logic

    Post the exact error message. There will (probably) be enough information there to help you track it down. Look at what the error message is trying to tell you. (Really: look at it!) If you don't understand it, maybe someone can walk you through the steps to debug it.

    Cheers!

    Z

  10. #10
    Junior Member
    Join Date
    Aug 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: need help with my program, not clear on diagonals or methods 3, 4 & 6 logic

    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6
    at Grid.checkForWin(Grid.java:189)
    at Grid.gameOver(Grid.java:256)
    at Grid.playGame(Grid.java:309)
    at GameMain.main(GameMain.java:9)
    Java Result: 1

  11. #11
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: need help with my program, not clear on diagonals or methods 3, 4 & 6 logic

    Well, i don't know but it would be occuring here
    if (board[i][j] == board[i][j + 1]
    most probably.
    Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young.

    - Henry Ford

  12. #12
    Member
    Join Date
    Jun 2012
    Location
    Left Coast, USA
    Posts
    451
    My Mood
    Mellow
    Thanks
    1
    Thanked 97 Times in 88 Posts

    Default Re: need help with my program, not clear on diagonals or methods 3, 4 & 6 logic

    Quote Originally Posted by wayfaring_stranger View Post
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6
    at Grid.checkForWin(Grid.java:189)
    ...
    The message is telling you to look (yes, really look) at line number 189 in your source file. An array is being addressed with an index value of 6, and that is invalid for that index.

    If you can't tell just by looking (really looking) at the code, then you can put some print statements to show you what the program is seeing at that point.

    For example suppose the error is flagged at this line:

            if (board[i][j] == board[i][j + 1]
                && board[i][j + 1] == board[i][j + 2]
                && board[i][j + 2] == board[i][j + 3]) 
    .
    .
    .
    Then print out the values of i, j, j+1, j+2, j+3 just before that statement is executed and see if any of the printed values is greater than the value of the corresponding dimension of the array. (According to your original post, the array was declared to have dimension [ROWS][COLUMNS] so in this statement, the value of i should be less than ROWS and j and j+1 and j+2 and j+3 should all be less than COLUMNS, right?)


    Cheers!

    Z

  13. #13
    Junior Member
    Join Date
    Aug 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: need help with my program, not clear on diagonals or methods 3, 4 & 6 logic

    ok I think I have a pretty good grasp of 2D arrays now.. I am pretty confident I have all the methods right now except my isColValid method. When I run the program and play 6 black... nothing shows up in column 6 when I play it. I am a student and just starting working with 2d arrays so I apologize that I don't know everything about debugging and knowing exactly what I should look for because this is my second class working with java and my teacher has her own way of teaching it so somethings I might need to know she might be teaching later on so there is nothing i can do about that.

    My entire code has changed a bit so ill post it all and highlight the isColValid method.

     
    import java.util.Scanner;
     
     
    /**
     * Grid class
     *
     * Layout of Grid    [0] [1] [2] ...
     *
     *               [0]
     *
     *               [1]
     *
     *               [2]
     *
     */
    public class Grid {
     
     
     
     
        private static final int ROWS = 6;
        private static final int COLS = 7;
        private char board[][];
     
     
        /**
         * 
         */
        public Grid() {
            //2D array to use as grid
            board = new char[ROWS][COLS];
            // Assign an * to each array cell
            for (int i = 0; i < ROWS; i++)
            {
                for (int j = 0; j < COLS; j++)
                {
                    board[i][j] = '*';
                }
            }
        }
     
     
        /**
         * 
         *
         * @return true if board is full, false otherwise *
         */
        private boolean fullBoard() {
     
     
            //variable to hold value for a full board
            boolean full = true;
     
     
            // Checks the board for empty spaces
            for (int i = 0; i < board.length; i++)
            {
                for (int j = 0; j < board[i].length; j++)
                {
                    if (board[i][j] == '*')
                    {
                        full = false;
                    }
     
                }
            }
            return full;
     
     
        }
    [COLOR="#FFFF00"]
    ***********************[/COLOR]
        /**
         * 
         *
         * @param col
         * @return true if col is on the grid
         */
        private boolean isColValid(int col) {
            //Variable to hold boolean value
            boolean valid = true;
     
           //check if user column in on the grid
            if( col >= COLS-1 || col < 0){
            valid = false;
        }
     
            return valid;
     
     
        }
     
    [COLOR="#FFFF00"]******************[/COLOR]
        /**
         * 
         *
         * @param column
         * @return "first" unoccupied cell in column return -1 if there is no
         * unoccupied cell in this row
         */
        private int firstEmpty(int column) {
     
            // Checks for * in the user given column
     
                for(int j = ROWS-1; j >= 0; j--)
                {
                    if(board[j][column]=='*')
                     {
                        return j;
                     }
     
     
               }
     
             return -1;
        }
     
     
        /**
         * 
         */
        private void showBoard() {
     
     
            for (int i = 0; i < board.length; i++) 
            {
                for (int j = 0; j < board[i].length; j++) 
                {
                    System.out.print(board[i][j] + " ");
     
     
                }
                System.out.println("");
            }
        }
     
     
     
     
        /**
         *
         *
         * @return true if there is a row, col, or diagonal of 4 matching colors
         * false otherwise
         */
        private boolean checkForWin() {
            //variable to hold boolean value
            boolean win = false;
     
     
            //Check for a win by row
     
     
            for (int i = 0; i < ROWS-1; i++) 
            {
                for (int j = 0; j <= COLS - 4; j++) 
                {
                    if (board[i][j] == board[i][j + 1]
                            && board[i][j + 1] == board[i][j + 2]
                            && board[i][j + 2] == board[i][j + 3]) 
                    {
                        if (board[i][j] == 'b' || board[i][j]=='r') 
                        {
                            win = true;
     
                        }
     
     
     
                    }
                }
     
     
            }
     
     
     
     
            //Check for a win by column
     
     
            for (int i = 0 ; i < COLS-1; i++)
            {
                for (int j = 0; j <= ROWS - 4; j++)
                {
     
                    if (board[j][i] == board[j+1][i]
                        && board[j+1][i] == board[j+2][i]
                        && board[j+2][i] == board[j+3][i])
                    {
     
     
                       if (board[j][i] == 'b' || board[j][i] == 'r')
                        {
                            win = true;
     
                        }
     
     
                    }
                }
            }
     
     
            // Check for a win diagonally bottom left to top right
     
                for(int i = ROWS-1; i > ROWS-4; i--)
                {
                    for(int j = 0; j< COLS-3;j++)
                    {
     
                        if(board[i][j]== board[i-1][j+1]
                        && board[i-1][j+1]== board[i-2][j+2]
                        && board[i-2][j+2]== board[i-3][j+3])
                        {
                         if(board[i][j]=='b'||board[i][j]=='r')
                         {
                             win = true;
     
                         }  
                        }
                    }
                }
     
                //check for a win diagonally from top left to bottom right
     
                for(int i = 0; i<ROWS-3;i++)
                {
                    for(int j=0; j<COLS-3;j++)
                    {
                        if(board[i][j]==board[i+1][j+1]
                        && board [i+1][j+1]==board[i+2][j+2]
                        && board [i+2][j+2] == board [i+3][j+3])
                        {
                            if (board[i][j]=='b' || board[i][j]=='r')
                            {
                                win = true;
     
                            }
                        }
                    }
                }
     
            return win;
     
     
        }
     
     
        /**
         * GIVEN
         *
         * @return true if there is a win or if the board is full
         */
        private boolean gameOver() {
            //game is over if there is a win or the board is full
            return this.checkForWin() || fullBoard();
        }
     
     
        /**
         * GIVEN
         *
         * @param column
         * @param color place color in first unoccupied row in this column (update
         * cell from '*' to color)
         * @return true if the play is successful, false if color cannot be placed
         * in this column
         */
        private boolean play(int column, char color) {
            //if the column is not valid, return false
            if (!this.isColValid(column)) {
                return false;
            }
            //find the first empty row in this column
            int row = firstEmpty(column);
     
     
            //see if column is full
            if (row < 0) {
                return false;
            }
            //else, set the cell to this color
            board[row][column] = color;
            return true;
        }
     
     
        /**
         * GIVEN driver method that controls game play
         *
         * @return when game is over, i.e. if win or if board is full (no "" in
         * cells)
         *
         */
        public void playGame() {
     
     
            do {
                //show the board
                this.showBoard();
                //ask user for a column and color
                System.out.print("Enter column (0 - 6) and " 
                        + "color (red or black):  ");
                Scanner kybd = new Scanner(System.in);
                int col = kybd.nextInt();
                String color = kybd.next();
                //play it
                this.play(col, color.charAt(0));
            } while (!this.gameOver());
        }
    }
    Last edited by wayfaring_stranger; September 6th, 2012 at 04:19 PM.

  14. #14
    Member
    Join Date
    Jun 2012
    Location
    Left Coast, USA
    Posts
    451
    My Mood
    Mellow
    Thanks
    1
    Thanked 97 Times in 88 Posts

    Default Re: need help with my program, not clear on diagonals or methods 3, 4 & 6 logic

    Quote Originally Posted by wayfaring_stranger View Post
    ...
    My entire code has changed a bit so ill post it all
    A good idea as far as it goes. (Actually a Great Idea, as far as it goes.)

    However...

    To make it easy for someone to help, how about showing a main() method that creates a Grid and makes some moves so that we can test and, maybe, help you walk through the debugging steps?


    Cheers!

    Z
    Last edited by Zaphod_b; September 6th, 2012 at 05:21 PM.

  15. #15
    Junior Member
    Join Date
    Aug 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: need help with my program, not clear on diagonals or methods 3, 4 & 6 logic

    ok i figured it out i have it working now. thanks for your help and patience

Similar Threads

  1. Name Logic for Program
    By aandcmedia in forum Java Theory & Questions
    Replies: 2
    Last Post: March 21st, 2012, 04:59 PM
  2. [SOLVED] Writing a program with arrays and class methods... PLEASE HELP?
    By syang in forum What's Wrong With My Code?
    Replies: 17
    Last Post: August 8th, 2011, 07:02 AM
  3. Replies: 1
    Last Post: May 14th, 2011, 04:57 PM
  4. help with the logic on this letter grade program.
    By etidd in forum Loops & Control Statements
    Replies: 2
    Last Post: January 28th, 2010, 09:14 PM
  5. Grade averaging program with array and multiple methods.
    By jeremykatz in forum What's Wrong With My Code?
    Replies: 8
    Last Post: November 9th, 2009, 09:44 PM