Search:

Type: Posts; User: Pinares

Page 1 of 2 1 2

Search: Search took 0.34 seconds.

  1. Replies
    19
    Views
    1,811

    Re: Polynomial Array List

    at first I had terms.add(null); which I thought was the problem, then I replaced it with terms.add(coeff); terms.add(expo); and after each time I used Sop(terms); and it has the same result.
  2. Replies
    19
    Views
    1,811

    Re: Polynomial Array List

    Okay, I fixed the output loop problem, now I'm still having trouble with my insert method:



    public void insert(int coeff, int expo)
    {
    for(int i = 0; i < terms.size(); i++)
    ...
  3. Replies
    19
    Views
    1,811

    Re: Polynomial Array List

    It does not give me a chance to put in another input.
  4. Replies
    19
    Views
    1,811

    Re: Polynomial Array List

    I guess it would be the input variable that controls the loop, i have:

    while(input !=null)

    but even after just one input, the input window closes and it starts printing. Maybe its the way I set...
  5. Replies
    19
    Views
    1,811

    Re: Polynomial Array List

    Still nothing for any variable on that line, but when I delete everything and just keep this line:

    System.out.println("insert method called for " + coeff + " " + expo);

    it prints in an...
  6. Replies
    19
    Views
    1,811

    Re: Polynomial Array List

    There is a println() statement at the end of the insert method that was printing earlier, but now not even that shows up. it gives me this message:

    Exception in thread "main"...
  7. Replies
    19
    Views
    1,811

    Re: Polynomial Array List

    So here is my latest insert method:


    public void insert(int coeff, int expo)
    {
    if(terms.isEmpty())
    {
    terms.add(null);
    }
  8. Replies
    19
    Views
    1,811

    Re: Polynomial Array List

    Okay. Sorry about that, I was getting a bit frustrated. Right now I am working on my insert method that adds terms to the list in descending order of power, I'm having trouble with the descending...
  9. Replies
    19
    Views
    1,811

    Re: Polynomial Array List

    As of now, the test class, this is what is has to do:


    III. The Test Class

    The main method of your test class will create a Polynomial object and then read and process a series of operations...
  10. Replies
    19
    Views
    1,811

    Polynomial Array List

    Here's the assignment:


    I. The Term Class

    Create a class to represent a term in an algebraic expression. As defined here, a term consists of an integer coefficient and a nonnegative integer...
  11. Thread: Bagels game

    by Pinares
    Replies
    23
    Views
    1,620

    Re: Bagels game

    That did it! Thanks a ton.
  12. Thread: Bagels game

    by Pinares
    Replies
    23
    Views
    1,620

    Re: Bagels game

    Nothing happened. The code compiled and ran like it should except for that piece of code. It might as well have not been there.

    Same thing happens when I use println() to print the value of play...
  13. Thread: Bagels game

    by Pinares
    Replies
    23
    Views
    1,620

    Re: Bagels game

    How can I check what is returned when the user clicks cancel? and that code does not work. I tried it.
  14. Thread: Bagels game

    by Pinares
    Replies
    23
    Views
    1,620

    Re: Bagels game

    Well clicking cancel normally means the user quit. I guess that's what I was going for when I was using null. Is that right or should I be trying something different?
  15. Thread: Bagels game

    by Pinares
    Replies
    23
    Views
    1,620

    Re: Bagels game

    before i had:

    if(userGuess == null)
    {
    //stuff
    }

    where userGuess is an int. It said "need int, found <null> incomparable types", so I added a string called play where I stored the userGuess...
  16. Thread: Bagels game

    by Pinares
    Replies
    23
    Views
    1,620

    Re: Bagels game

    I tried if(int == null) but it says i can't compare the two. Would I have to initialize a new variable to compare?
  17. Thread: Bagels game

    by Pinares
    Replies
    23
    Views
    1,620

    Re: Bagels game

    What reserve word do I use for when the user quits? I cannot use null in a boolean because they are incompatible types.
  18. Thread: Bagels game

    by Pinares
    Replies
    23
    Views
    1,620

    Re: Bagels game

    That did it. Here is my new code:


    import java.util.Random;
    import javax.swing.JOptionPane;
    //import javax.swing.JOptionPane;

    /**
    * A class to play the game of Bagels
    * @John Pinares
  19. Thread: Bagels game

    by Pinares
    Replies
    23
    Views
    1,620

    Bagels game

    I have to program a game called Bagels. This is how it is suppose to go:
    -------------------------------------------------------------------------------
    This assignment is to write an interactive...
  20. Replies
    11
    Views
    1,972

    Re: Combination lock

    Its because the test class does not know which input goes to which position. I'm sure I have to implement the counter into the test class. I don't know how though, like in the first input, the test...
  21. Replies
    11
    Views
    1,972

    Re: Combination lock

    Okay, now regardless of the input, right or wrong it gives me this message in the out put right after it prints the user input:
    "The combination to MasterLock is JAP
    The user entered combo is JAP...
  22. Replies
    11
    Views
    1,972

    Re: Combination lock

    I actually fixed the printing problem. Now the prototype program runs fully but I still can't get the arguments in the setPosition method to match the ones in the lock class. I know the counter is...
  23. Replies
    11
    Views
    1,972

    Re: Combination lock

    I cannot do that since I have to declare input2 before I print it, and since it is declared in the input it does not get the chance to print the length. As soon as type the second character and press...
  24. Replies
    11
    Views
    1,972

    Re: Combination lock

    So the string "input2" is longer than 1 character?
  25. Replies
    11
    Views
    1,972

    Combination lock

    For starters, I have no clue how to use the counter IV. I'm trying to create a combo lock with a 3 letter combo. in my test class I try to use the setPosition() method to try out a random or the...
Results 1 to 25 of 32
Page 1 of 2 1 2