Jairo Navarrete

Greenhorn
+ Follow
since Mar 07, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Jairo Navarrete

yeah she wants it done how the assignment says, this helped me out a lot guys thank you so much
10 years ago
ok so for class I'm supposed to Write a class DeleteElements that prints out an array and asks the user which number should be
deleted and then deletes that number, if it exists from the array.

the first part tells me to


Step 1
o Start by simply searching the element.

o Pseudocode:
Create an array and populate it with random positive integers.
Print the array to show the user which elements the array contains.
Use a WHILE loop to search the element—a WHILE loop is better than a FOR
loop because you can stop when the element is found by using a Boolean
value in the loop condition—and also keep track of the location where the
element might be found.
If the element is not found, output the error message, “Number not found.”
Otherwise output the message, “Number found at index #.” where # is the index
where the element is.
Print out the array.

Example of output:
34 65 12 76 45 39 86 71 67
Number to delete: 76
Number found at index 3



this is what I've got so far but I can't seem to get the "number not found part to print out only once".




Current output result if value does not exist:

61 89 52 16 20 71 37 91 4 36
Number to delete:
23
Number not found.
Number not found.
Number not found.
Number not found.
Number not found.
Number not found.
Number not found.
Number not found.
Number not found.
Number not found.
Current output result if value exists:

97 48 51 22 89 5 42 97 43 96
Number to delete:
89
Number found at index 4


Maybe I'm not understanding the part about the boolean value.
I would appreciate all the help i could get.
10 years ago
just copy and paste it in between [code=java*]Here[/code*] take out the *
10 years ago
Hey guys long time since I've visited this great site been following this java tutorial on making the snake game, and as I followed along at added the second player. Right up to the point I got into the resetting if I hit borders or myself or the other player, the snakes stopped moving when i tried hitting keys

I would be grateful for any help thanks

problem started up to the point where I added snake2 in the GenerateDefaultSnake method









10 years ago
Oh ok haha I was confused. Thanks
11 years ago
How would I be able to use if (true) with the equalsIgnoreCase()? Is there another way to ignore the Casing ?
11 years ago
BAM !

I hope this is what you guys meant

It works like a charm



@Jeff Thanks for clearing that up I'll look more into the compareToIgnoreCase
11 years ago
Oh Ok. Well I'm just beginning so I wasn't really sure what he meant by that.

And thank you very much Darryl and Jeff for the example

I was looking at the http://docs.oracle.com/javase/6/docs/api/java/lang/String.html

and on the method summary and i found

compareToIgnoreCase(String str) Compares two strings lexicographically, ignoring case differences.

or might be this i need

equalsIgnoreCase(String anotherString) Compares this String to another String, ignoring case considerations.

I'll rewrite it using the latter and see how it comes out
11 years ago
cool thanks I rewrote it though to this now it works fine for every result


11 years ago
Awesome thanks, I did this and it worked...



but I also did this and it gave me no errors...



either of them correct way ?
11 years ago
Not sure how to fix this problem. Can anyone explain what I did wrong please ? What data type I should be using ?

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The operator | is undefined for the argument type(s) boolean, String



Thanks
11 years ago