Chan Duller

Greenhorn
+ Follow
since Oct 15, 2015
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chan Duller

It is shown in the getLetterCount() method.
5 years ago
I am trying to fill in the code for the updateLetterCount() method, which should be quite similar to the updateDigramCount() method.
However, I am stuck. Any suggestions would be helpful! I am having trouble with defining the letter variable,
because I know it has to be defined for the Map. Any idea about how to go about doing so?



5 years ago
Well, one room could have the key item stored in it. So when you reach that room, you can collect it and use it to unlock the exit that is locked.
5 years ago
Ex. 6.44: Add locked exits to your game. The player needs to find (or otherwise obtain) a key to unlock the exit and enter a room. (You don't need to add a new class for doors or exits to your game). Make this as general as possible - in any room, any exit could potentially be locked.

I have no idea how to do this. One idea was to make a HashMap with direction as keys and boolean (true/false) as values. Any suggestions?

5 years ago
Sorry, I am just a beginner. Where do I put the getKey() and getValue() part? Do I need to still override the toString() method if I make those changes? And if so, how do I?
Thanks!
5 years ago


Above is what I have for the method so far, and it compiles. But when I run it, I get the response in the screen shot. I sent two messages to user A. The first issue is that I just want user A: message 1, message 2...etc.
I don't want user A: message 1, user A: message 2, etc. The second issue is that it is not actually returning the emails for the user...it seems to be returning an address. The rest of my code it below.

5 years ago
There is no error. It just isn't returning the correct results. It is the getNextMailItem() method that is returning null. How it runs is that you create a server object. Then you create mail client objects on that server, and then can send mail items to each other. When I do send one, it is returning null for the getNextMailItem() method for the person it is sent to. Does that make sense?
5 years ago
I am having trouble getting the getNewMailItem() method to work. Everything compiles fine, but it returns null every time even if there are multiple mail items in the server. Can anyone help me with this? I have tried using the debugger to step through and do not see any issues, but maybe I'm missing something. Thanks in advance!

5 years ago
I just figured out that it is because it expects a String return type. My only question is, how do I work it when the default response is in String form, and the other is in ArrayList form?
5 years ago


This is the update, but now I am getting the following error: incompatible types: java.util.ArrayList<java.lang.String> cannot be converted to java.lang.String.
5 years ago


This is what I have added, but I am getting an error when I try to use the add feature of ArrayLists. Any suggestions?
5 years ago
Thank you for the code tags. There is no solution to it yet. I did the first part, which was to make a second HashMap with synonyms of keywords from the first. However, I cannot figure out where to start for the second part where we need to be able to get both values (responses) returned if the prompt includes two keywords.
5 years ago
Identify multiple keywords in the input, and respond with both values (HashMap). Someone might type in "my windows PC crashed". The SupportSystem class should print out responses for both "windows" and "crashed". You should not have the Responder class do any printing. Also, be sure to print each response out only once (i.e. typing in "crash crashed" should not cause the same response to be printed twice).

5 years ago
I have been struggling for hours to figure out how to do this. I already have a method that randomizes the answer every time I roll the dice called throwDice(). However, I can't seem to figure out how to return the answer. I am attaching my code thus far.

Add to your demo() method a loop that invokes throwDice() a million times, and print out the number of times you got a 1, the number of times you got a 2, and so on up to 6. These numbers should all be about 1/6th of a million. Here is an example of what your output should resemble (it won't be identical):
1: 166674396
2: 166690012
3: 166659722
4: 166662230
5: 166665847
6: 166647793

6 years ago