Search:

Type: Posts; User: Bayonetwork

Search: Search took 0.24 seconds.

  1. Replies
    23
    Views
    293

    Re: Error displaying matrix?

    No I dont know how to catch the error. I just want to create a while loop that prints a message saying Error invalid entry until they input a valid integer.

    Example:

    How many disks should we...
  2. Replies
    23
    Views
    293

    Re: Error displaying matrix?

    Yes I deleted that line and if I input 0 it does nothing and if I input a character it throws an exception on my int userinput = keyboard.nextInt(); for an input mismatch. Obviously because I enter a...
  3. Replies
    23
    Views
    293

    Re: Error displaying matrix?

    Again, I just wrote that as a placeholder. "int" in the line if (user input == int) is a syntax error and will not compile. That is just what I want it to do but dont know how to code for it. In...
  4. Replies
    23
    Views
    293

    Re: Error displaying matrix?

    It just gives me an invalid expression error for the if (userinput == int) line. I just wrote that as a placeholder until I know to do for "int."
  5. Replies
    23
    Views
    293

    Re: Error displaying matrix?

    I do have another error checking question in the following code between the error checking start and end segment:


    import java.util.Scanner;

    public class Recursion {

    public static void...
  6. Replies
    23
    Views
    293

    Re: Error displaying matrix?

    Solved:


    public void display() {
    for (int i = 0; i < rows(); i++){
    for (int j = 0; j < columns(); j++){
    System.out.print(matrix[i][j] + " ");
    }...
  7. Replies
    23
    Views
    293

    Re: Error displaying matrix?

    This sounds like what I want to do. How do I determine when the last element is printed?
  8. Replies
    23
    Views
    293

    Re: Error displaying matrix?

    My code is properly formatted it just didnt preserve it when I copy/pasted to this forum from Eclipse. All the brackets and statements are where they should be.
    Thanks!
  9. Replies
    23
    Views
    293

    Re: Error displaying matrix?

    I need it to have the format:

    1 2 3
    4 5 6

    with tab spacing.

    And allow for any size matrix the user might input. This is just a simple 2 x 3 example.
  10. Replies
    23
    Views
    293

    Re: Error displaying matrix?

    I need to be able to display to the console the rows and columns of the matrix.
    Heres the matrix I want to display in the same format:


    import java.util.Scanner;

    public class MatrixMain {
    ...
  11. Replies
    23
    Views
    293

    Error displaying matrix?

    Im getting an exception in my display method.
    I need to be able to display to the console the rows and columns of the matrix.
    Heres the matrix I want to display:

    import java.util.Scanner;
    ...
Results 1 to 11 of 11