Jacqueline Turof

Greenhorn
+ Follow
since Apr 18, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Jacqueline Turof

On the side where the JUnit bar is, it says there is one error and lists it as initializationError(0.000 s). So I'm assuming I'm not setting up the constructor right at all. I didn't use the @Before in any of my other JUnit attempts when I was able to get them working. Maybe I'm not using it properly?
11 years ago
Thanks for your reply and with that information I was able to make some simple JUnits run and work.
Now, I'm getting stuck on more complex testing. I am trying to test the constructor for my HangmanLogic class. The
constructor is public HangmanLogic(String keyPhrase, int numberOfGuesses) throws InvalidConfigurationException
Just trying to start the testing with making sure the information being passed into the constructor is what it should be. I
keep seeing an initializationError.








public class AlreadyGuessedException extends Exception
{
public AlreadyGuessedException(String message)
{
super(message);
}
}
11 years ago
Hi,

I'm suppose to be creating a JUnit test and I feel like I don't really understand these JUnit tests at all.
Does anyone know of a good tutorial to look at? I've been looking around and have been unable to find one.
This assignment is due Sunday and at this point I'm not even sure how to begin tackling this problem. Thanks, for any pointers or help.
11 years ago
Ah, thanks I see it now. Sometimes you look at something so many times you stop actually seeing what's there. lol Thanks, again!
11 years ago
Hi,

I'm suppose to be creating two recursive methods. One to figure out fibonaccis numbers and one to figure out if a string is a palindrome. I keep getting the error that my palindrome method must return a boolean. However, I feel like I have done that and don't understand why I'm getting this error message. I just want to test my methods to make sure the logic is correct, but can't even get that far. Any help is appreciated, thanks!



11 years ago
So, I'm back. I've been able to create a board object, but now I'm having a new problem. I'm trying to write a play() method using a board object. I am unable to set up a loop that checks for a win. I've added println statements in the program trying to check the loop and see how its actually working, but I still can't tell what is going on. The reason the loops are set up differently for an X horizontal win was for diagnostic purposes. None of the those testing 1,2,3 print ln statements printed to the console and the loops never ended. If anyone has any advice or insight it would be greatly appreciated. Thanks in advance.

11 years ago

fred rosenberger wrote:

Do you actually get to the "board [i][j]= "-"; " line? I would think (and this is a guess) that you get the NPE on line 4 here. you are trying to get the length of an array that doesn't exist.>



Thank you for all your help. I was finally able to get it working.
11 years ago

fred rosenberger wrote:a line like this:
String [][] board= new String [3][3];

creates an array, but it has nothing in it.

Also..remember that java doesn't have multi-dimensional arrays. it has arrays that hold objects - and those objects can be arrays.

So, after this line, you have an array that can hold three things (which have to be arrays of String), but those things don't exist yet. So you can't call a method on them.



I thought I was filling the the array with the board [i][j]= "-"; statement? Thanks for the responses, they've been very informative.
11 years ago
So I've made some changes to my code and I am throwing a NullPointerException and can't figure out what I'm doing wrong.

For my code part of the requirements are that I create a board by making a multidimensional array and that I create a method with the header public String currentBoard() that returns the state of the board as a multi line String. Here is my code so far.



I have a checking class with a main method so that I can make sure things are working as they should.


Any one have any ideas why I'm getting the error NullPointerException? Any help is appreciated!!!
11 years ago
I'm working on creating a program where I can run two different games. I've just started and I'm stuck on just creating a tic-tac-toe board.
When I test to make sure that the board is set up properly it comes back as null. I'm obviously not setting my values for my array properly and was hoping someone had some advice. Thanks in advance!




11 years ago
Thanks for the fast reply and the help. I was able to fix my code and have it working now.
12 years ago
I just started taking programming course in Java and I'm trying to write a guessing game. I would like the user to be able to start the game over again without having to restart the program. Every time I try to set up a loop to do this it never goes through the enter loop again. I'm just not constructing the loop properly, but I'm not sure how I can correct it. Any help or suggestions on how to improve my code would be appreciated. Thanks in advance!

12 years ago