Search:

Type: Posts; User: pbrockway2

Page 1 of 20 1 2 3 4

Search: Search took 0.61 seconds.

  1. Replies
    4
    Views
    80

    Re: A question about 'homing' objects

    If A is at (ax,ay) and B is at (bx,by) and you want B to move towards A by a fixed distance m, you figure out the ratio m/d where d is the distance you have found. Then it's just a matter of...
  2. Re: gpa calculator simple mistakes but need help

    Hi mortimer10, welcome to the forums! Could you have a look at the Announcements page to see how to format your code. You can edit your post by clicking "Edit post" near the bottom. You may find...
  3. Replies
    5
    Views
    48

    Re: Cannot find symbol?

    The method declaration is wrong. It should include a variable:



    private void setTexto(boolean b) {
  4. Re: passing a boolean parameter from one method to the other(without global variable)

    What the compiler is saying is that the defineFront() method must have two arguments: an int and an array of boolean values. You have not given the method the second argument.

    Providing a boolean...
  5. Replies
    8
    Views
    111

    Re: power of math

    You'd have to post the actual code. My guess is that you say



    double squaredR = pow(radCylinder,2); //initialized


    before you assign the actual value to radCylinder with nextDouble(). As...
  6. Replies
    8
    Views
    111

    Re: power of math

    You are using a variable R and the compiler is complaining that it might not have been given a value. In fact the compiler is right to complain because you haven't given R a value. (I'm guessing...
  7. Replies
    8
    Views
    111

    Re: power of math

    The code you posted doesn't use pow(2), it uses radCylinder*radCylinder. Post the code which shows the problem and describe what happens when you compile and/or run that code. The point is to...
  8. Re: How to set starting point to read a text file in java

    You could read the first 53 lines in a for loop and simply do nothing with them.

    Ultimately all you have are the methods of FileReader, including the Reader and other subclass methods that are...
  9. Replies
    3
    Views
    83

    Re: Loop is breaking

    You have to try it and see! If something is still going wrong, post code and describe the problem.
  10. Replies
    3
    Views
    83

    Re: Loop is breaking

    Always use braces with if statements.



    if(whatever) {
    // code which should execute
    // if whatever is true
    }
    // more code
  11. Replies
    9
    Views
    177

    Re: Cool Numbers

    Actually I said the problem had a different name. It crops up all over the place: your cool numbers, but I saw it (for the first time) recently in some online lectures on origami of all things.
    ...
  12. Replies
    3
    Views
    119

    Re: Coupling and code duplication

    Yes, it's "public static final" but built into the type system so that it's more powerful. Given a variable or expression of enum type you can use it in a switch statement, for example. Unlike...
  13. Replies
    3
    Views
    119

    Re: Coupling and code duplication

    I'm not sure whether I'm understanding this correctly, but the command words are different from the game's implementation of commands.



    If I am understanding correctly, you mean every time you...
  14. Replies
    6
    Views
    131

    Re: Comparing string data

    It might have been better to continue your previous thread where you did use the equals() method.

    What are the incorrect results you are getting? (and the code you use to get them)
  15. [SOLVED] Re: String method that creates a word out of given letters (Need a little help, please step in)

    Yes, agreed. StringBuilder is better.
  16. Replies
    9
    Views
    177

    Re: Cool Numbers

    That's a reasonable attempt for 4 digit numbers. Although it will fail sometimes, like 3111 (this case could be checked for separately.)

    This is a standard problem, and it's not easy so don't be...
  17. Replies
    3
    Views
    93

    Re: Converting Array into ArrayList

    I would assume your teacher wants you to use arrays not lists (or they would have mentioned lists...)

    Iterators are a specific Java interface, but we also use the verb "to iterate" more generally....
  18. Re: need to refresh Java skills feel like a total newbie here (whats wrong in my code?)

    It turns out that when I read the (smaller) 1ed, the bookshop only had the Pascal edition. I was programming in C/C++ so that was a bonus ... I had to reimplement the code, ie actually read the...
  19. Replies
    3
    Views
    69

    Re: viewing .java file as .txt file

    Ah! I've just realised you mean the format of the output. Yes, just run it and see. (I think you might have missed a %n near the end...)

    Generally threads aren't deleted - who knows they might...
  20. Re: need to refresh Java skills feel like a total newbie here (whats wrong in my code?)

    Personally I think the nonstandard StdIn/Out classes might be confusing. But I'm me. And Robert Sedgewick is Robert Sedgewick.

    I read the first edition of his book over half a lifetime ago and...
  21. Re: JFrame windowClosed event not being fired

    Umm... Wouldn't the "Are you sure to close this stable door?" message be a bit late in response to a window closed event?
  22. Re: JFrame windowClosed event not being fired

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    This line won't help! Not only should you DO_NOTHING_ON_CLOSE, but you should add the listener (this) to the frame (also...
  23. Re: need to refresh Java skills feel like a total newbie here (whats wrong in my code?)

    What is the error?

    ---

    The code is the main() method from UF.java which is a part of the Union Find case study from Sedgewick and Wayne's Algorithms. (When you are posting someone else's code...
  24. Replies
    5
    Views
    98

    [SOLVED] Re: erorr String index out of range

    The error message here is quite helpful. Since strings are "zero based", the index values of "Hello" are 0,1,2,3,4 so it is no wonder the runtime gets upset about you using an index of 5.

    What is...
  25. [SOLVED] Re: String method that creates a word out of given letters (Need a little help, please step in)

    According to the API documentation: "public String replace(char oldChar, char newChar) Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar". You are...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4