There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Campbell Ritchie wrote:Welcome to the Ranch
Start by moving all that code out of the main() method. It is not intended for writing business logic (nor games logic). That code all belongs in different methods, probably in different classes. Also, such a long method is a maintenance nightmare.
Don't use the == operator on Strings. Your test in line 101 is guaranteed to go wrong.
Trystin Garcia wrote:am having trouble understanding the use of more than 1 method. Is it neatness or is there an actual reason.
Not Equals but equals please, but call it a method, not a function. People will understand you better if you use the correct jargon.Trystin Garcia wrote:. . .I have to rewrite the =='s using the Equals function, . . .
Yes it does, but you aren't presenting it with yes or no. Have you changed your code? If so, please show us it. Did you understand what I linked to about nextLine() in my earlier post?it doesn't allow me to answer the yes or no question.
So you haven't solved that problem. Have you looked at the links I gave you?Trystin Garcia wrote:. . . While the Change Case finishes then doesnt let you type N, and just ends the code
Trystin Garcia wrote:
Please tell us what you don't understand and we shall try to explain it, just as Bob Winter is already trying to help you.Trystin Garcia wrote:. . . hard to understand
No.Bob Winter wrote:. . . got from int to a line? . . .
Have you tried that? Make sure to wrap it in quotes to make it easier to read: System.out.printf("Continuation = \u201c%s\u201d%n", continuation);How about printing continuation to see whats in it?
Junilu Lacar wrote:Compare how much easier this would be to read and comprehend vs. the giant block of code that you have written:
Then you'd have smaller methods for doView(), doSearch(), etc., with each subtask being done in its own special "room" in your program.
How would I give the all 4 methods the arrays to use.
I did what you said.
So this is my second test file, how would I pass the info of the array to all 4 of them
All things are lawful, but not all things are profitable.
What's wrong? Where are you going? Stop! Read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|