Search:

Type: Posts; User: KristopherP

Search: Search took 0.10 seconds.

  1. Replies
    7
    Views
    1,382

    Re: Need Help with StringTokenizer.

    Im trying to do this but I am a still having problems because I still have strings. I need the infix expression to be in a character array to pass to my methods and the numbers to be integers to...
  2. Replies
    7
    Views
    1,382

    Re: Need Help with StringTokenizer.

    Im not trying to parse it into an int. The code is wrong. I am asking what I need to do to read the first line which will be an expression.

    Then read the second line which are numbers and parse...
  3. Replies
    7
    Views
    1,382

    Re: Need Help with StringTokenizer.

    I understand this. I can not figure out how to go through the file.
    the way I wrote the while loop
    test = st.nextToken();

    grabs the next token which is A


    numbers =...
  4. Replies
    7
    Views
    1,382

    Need Help with StringTokenizer.

    I am having trouble with StringTokenizer. I have an input file that has an infix expressions followed by
    a set of numbers which are the values for the variables

    A + B * C
    1 3 5 2 2 2

    The...
  5. [SOLVED] Re: Reading from a file and storing to array's. Names are working but numbers are not

    Sorry that was just meant to imply that I was printing index 0 of the array's. When I went back to check the code I seen that I was trying to print a [] array when they were [][]. I made the change...
  6. [SOLVED] Reading from a file and storing to array's. Names are working but numbers are not

    I am trying to copy the contents of a file into an array.
    The contents of the file is
    John X Doe 4.0 6 8.2 9

    I had some typos and it would not read the names. Now I got the names storing to an...
  7. [SOLVED] Re: Copying a file to an array and getting exception thrown for input

    Instructor gave us an assignment to do which was the final for her CS1 class. I did not have this instructor and did not learn StringTokenizer or String.split() in my CS1 class. StringTokenizer...
  8. [SOLVED] Copying a file to an array and getting exception thrown for input

    I am trying to copy the contents of a file into an array.
    The contents of the file is
    John X Doe 4.0 6 8.2 9

    The code the instructor wrote on the board. I inputted it and when trying to run I...
  9. Replies
    14
    Views
    3,664

    Re: Writing a getColor() method

    Thanks for the input and links but, I am not getting it. I got my program to perform by using the locations in the arrayList since I know where each object is. I would still like to create a method...
  10. Replies
    14
    Views
    3,664

    Re: Writing a getColor() method

    I am not sure I do not know if it is an object or string


    It is , I need to return the variable from Color c Im just not sure how since Im confused on the method header and code. The text book...
  11. Replies
    14
    Views
    3,664

    re: Writing a getColor() method

    Thanks but, the problem is I do not know how to do a getColor() method. I do not know what the return type should be or what code I would use to get the color from one of my objects
  12. Replies
    14
    Views
    3,664

    Writing a getColor() method

    I believe my previous post was in the wrong section. I need a way to check the color of objects in an arrayList. I included my Block class and what I have so far. I am not sure what I need to...
  13. Replies
    14
    Views
    3,664

    re: Writing a getColor() method

    My main question is do I need to create a getColor method or can I use the getColor that is already available as part of Color.
    If I can use the getColor already available that is getColor(String...
  14. Replies
    14
    Views
    3,664

    Writing a getColor() method

    I am having trouble with a simple game. I have a game made with Blocks. The blocks are made as
    Block(double x1Lc, double y1Lc, double w, double h, Color c)

    They are then added to an ArrayList. ...
  15. [SOLVED] Re: java.lang.StringIndexOutOfBoundsException: String index out of range: 0

    I did the nested if and it worked. Thanks for your help
  16. [SOLVED] Re: java.lang.StringIndexOutOfBoundsException: String index out of range: 0

    I tried your suggestion with

    if( size > 0)
    {
    answer = input.charAt(0);
    }


    When I get to the next part it tells me answer is not initialized
  17. [SOLVED] Re: java.lang.StringIndexOutOfBoundsException: String index out of range: 0

    So if I added something like this to check the length of the string, where would I need to add it to prevent the crash? Would I had a comparison to my if statement?

    int size;
    size =...
  18. [SOLVED] java.lang.StringIndexOutOfBoundsException: String index out of range: 0

    I am having trouble with my program. I finished it but, I can not get the begging to cooperate. I need to take a users input if they would like to play a game. I have to use the charAt method to...
Results 1 to 18 of 18