Please Help

Started a new module for the course I'm taking, this is the first one since I started that I've really struggled with and can't seem to find the solution. I know the code is a bit of a mess but if anyone could tell me what's wrong I'd really appreciate it.
No description
No description
10 Replies
JavaBot
JavaBot6mo ago
This post has been reserved for your question.
Hey @Kamizama! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
DokaDev
DokaDev6mo ago
I think it's because it says it returns a String but there's no return value? The side that returns a double below also needs a return clause.
Kamizama
KamizamaOP6mo ago
Thank you, I thought that could be it as well however it is still not running, would you be so kind to guide me on this matter if it's not too much to ask.
JavaBot
JavaBot6mo ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Kamizama
KamizamaOP6mo ago
These are the errors I get
No description
No description
DokaDev
DokaDev6mo ago
So, looking at the first photo, the Sandwich constructor doesn’t have an overload that takes no parameters it’s only got public Sandwich(String mainIngredient, String bread, double price). But the first error shows that someone tried to call Sandwich() with no arguments, which is obviously the problem. Basically, once you define a constructor that takes parameters, Java stops giving you a no-arg constructor by default. So if you want to be able to create a Sandwich without passing anything in, you’ve got to write that empty constructor yourself, no way around it.
Kamizama
KamizamaOP6mo ago
Got you, thank you so much you're a life saver
JavaBot
JavaBot6mo ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Kamizama
KamizamaOP6mo ago
That did the trick, really appreciated
JavaBot
JavaBot6mo ago
Post Closed
This post has been closed by <@488806021247008800>.

Did you find this page helpful?