Win a copy of Microservices in Action this week in the Web Services forum!

Jeremiah Waters

Ranch Hand
+ Follow
since Oct 18, 2018
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
15
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jeremiah Waters

Good afternoon! I'm trying to write a code that will output a word length() number of times. For example: If I entered "hippo," it would output "hippo hippo hippo hippo hippo" because hippo has 5 letters. With my current code (which I've included below), I'm receiving the "error: error: missing return statement }." I figure this is an issue with variable "word" not having anything assigned to it, but I'm not sure how to fix it. Any suggestions?

Class 1-
import static java.lang.System.*;
import java.util.Scanner;


Class 2-


Thank you so much!
1 week ago
Thank you so much for the help!
3 weeks ago
Ok thank you! I added "char" before let, but now I am receiving the following errors:

Decoder.java:37: error: cannot find symbol
   return let + " decodes to " + decode() + "\n";
          ^
 symbol:   variable let
 location: class Decoder
Decoder.java:37: error: method decode in class Decoder cannot be applied to given types;
   return let + " decodes to " + decode() + "\n";
                                 ^
 required: char
 found: no arguments
 reason: actual and formal argument lists differ in length
Main.java:17: error: constructor Decoder in class Decoder cannot be applied to given types;
 Decoder test = new Decoder(let);
                ^
 required: no arguments
 found: char
 reason: actual and formal argument lists differ in length
3 errors

1) How can I call let and decode() in my final line of code that will produce the value assigned to let and the information found in decode()?
2) What is the issue with my constructor?
3 weeks ago
Thank you!
The following is my updated code:

I'm currently receiving the error "error: <identifier> expected. public static char decode(let)." What does this mean?
3 weeks ago
I'm trying to create a code that will decode each letter. LowerCase becomes UpperCase. UpperCase becomes LowerCase. Digits 0-9 become A-J. Any other characters become #. I'm receiving an error on the final lines saying "error: ';' expected in String toString()," but I don't know how to fix this. Any help? Thank you!

Class 1

Class 2

Error:
3 weeks ago
Thank you all for your help! I was misreading an error and resolved the issue! I will take everyone's input to heart when reworking my code to be more efficient; thank you for your time!!

For anyone having a similar issue, here is my final code:


3 weeks ago

Junilu Lacar wrote:I would just write some JUnit tests:



Thank you for this suggestion! I may try this approach to my code after I complete it in its current form. However, I'm still looking for assistance with my original question:

Jeremiah Waters wrote:I want to add some more test cases to the code below, but I'm not quite sure how to format those additional test cases. I'm trying to get it to where it'll ask for me to enter several letters (sort of an "enter letter" then output response, "enter letter" then output that response, on and on). Can anyone help?

3 weeks ago
Sorry for the confusion. I'm trying to get it to where it'll ask for me to enter several letters (sort of an "enter letter" then output response, "enter letter" then output that response, on and on). I didn't explain that as clearly as I could've, sorry.
3 weeks ago
Thank you! I'm working on your suggestions now, but is there any way that you can answer my original question for this thread? It pertains to both the code used in my original thread and this one; I'm just confused on how to format the additional test cases with the imported scanner-

Jeremiah Waters wrote:
I want to add some more test cases to the code below, but I'm not quite sure how to format those additional test cases. Can anyone help?

4 weeks ago
Sorry, I didn't realize that you were replying on this forum! I'll try that!
4 weeks ago
I attempted to ask this question several times across several of my posts, but each time it was passed over in favor of helping me fix other issues. If I'm remembering correctly, I've asked a separate three times, which I can find if needed. While I do appreciate the help with my other issues, this is a issue and I felt that maybe posting it separately would get the help I needed. The title of my other thread was also "Final line of code not returning proper values," and I felt that maybe asking this question separately may help others trying to find a solution to a similar issue.

I will not duplicate my questions in the future, but I would appreciate it if you close this thread, and not the thread on which I was actively receiving help with a separate issue, so I can continue working.
4 weeks ago
Good evening!

I want to add some more test cases to the code below, but I'm not quite sure how to format those additional test cases. Can anyone help?

Class 1-

Class 2-



Thank you very much for the help!
4 weeks ago
Okay, thank you! You were correct in that I didn't close my statement with a } (which did fix the last error I posted above), but you mentioned that my line 31 will not compile. How can I fix that specifically (I'm sorry if you answered that in your previous response, but I'm not understanding)? Thank you!
4 weeks ago
Thank you, sorry for the late response!

I tried your solution, which gave me this code-


But now I'm receiving these errors-


How can I fix this?
4 weeks ago
Thank you!

When you say "decode( char c )" do you mean "Decoder( )" or "Decoder( char let )" ? Do you mean I should I make Decoder () private and make Decoder( char let ) public static?
4 weeks ago