Forum: Java Nov 22nd, 2009 |
| Replies: 5 Views: 475 Thanks for your aid. I modified my program to what you said but used a for loop instead. It works. Thanks. |
Forum: Java Nov 22nd, 2009 |
| Replies: 5 Views: 475 Thanks, I modified my code to what you said but I used a for loop instead. It works quite well now. Thanks for your aid. |
Forum: Java Nov 20th, 2009 |
| Replies: 5 Views: 475 Sorry, I was absent for some days. I tried what you said and I came up with the following code. My problem is that it only returns me one position. I call it also to print the positions in the main... |
Forum: Java Nov 18th, 2009 |
| Replies: 5 Views: 475 I want to write a program to conduct a binary search and return all the occurrences of a number to the user. I succeeded in coming up with a binary search method but I don't know how to make return... |
Forum: Java Nov 8th, 2009 |
| Replies: 1 Views: 615 I just figured a way to do it. |
Forum: Java Nov 8th, 2009 |
| Replies: 1 Views: 615 Hey everyone, I am trying to write a code which would read a file and print the number of words and sentences in each of them. I want to take everything step by step; so I am making sure that all my... |
Forum: Java Nov 1st, 2009 |
| Replies: 7 Views: 9,338 If you want to check whether a string is equal to another, use the .equals method. For example:
...
String one = "X";
String two = "X";
if (one.equals(two))
{ System.out.println(one + " = " +... |
Forum: Java Oct 28th, 2009 |
| Replies: 18 Views: 466 ok thanks. I would see what I can do. Thanks again! |
Forum: Java Oct 26th, 2009 |
| Replies: 18 Views: 466 So i need to change my indexOf method, right? |
Forum: Java Oct 26th, 2009 |
| Replies: 18 Views: 466 Thank you for the explanation. Everything is clearer now. I have filled in all the methods and I my program runs almost perfectly. The only problem remaining now is that when I enter a word or letter... |
Forum: Java Oct 24th, 2009 |
| Replies: 18 Views: 466 I thank really really much! I like it when people correct me spotting out all my mistakes b/c from there, I learn much more than when i am told of my small mistakes. I just have a request that may be... |
Forum: Java Oct 23rd, 2009 |
| Replies: 18 Views: 466 ok thanks. Here is the class with the methods
public class stringCensor {
// Declare all the variables going to be needed
private String x, y, userInput, bannedWord,... |
Forum: Java Oct 22nd, 2009 |
| Replies: 18 Views: 466 what I thought was that, by replacing the bad word everywhere it occurs in the string(this is what it does), theWord is automatically set to the second word we want to replace by *. |
Forum: Java Oct 22nd, 2009 |
| Replies: 18 Views: 466 |
Forum: Java Oct 22nd, 2009 |
| Replies: 18 Views: 466 I don't want to reset the string
I just want to keep working with the first one i enter |
Forum: Java Oct 22nd, 2009 |
| Replies: 18 Views: 466 I put it in it and this is what it gives me:
Enter your string: i am not happy of this
The string is: i am not happy of this
Enter the bad word: o
The censored string is: i am n*t happy *f... |
Forum: Java Oct 22nd, 2009 |
| Replies: 18 Views: 466 A sample run is as below:
Enter your string: jjjk
The string is: jjjk
Enter the bad word: k
The censored string is: jjj*
Enter 1 to continue, 2 to quit: 1
You chose 1
The string is: jjj* |
Forum: Java Oct 22nd, 2009 |
| Replies: 18 Views: 466 I have to write a program to censor a string. Whenever I run the program, it works fine the first time, then stops progressing the second time after entering the bad word. I don't get what the... |