#Problem with the code not running and instead giving me error
1 messages ยท Page 1 of 1 (latest)
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
Here is an AI assisted attempt to answer your question ๐ค. Maybe it helps! In any case, a human is on the way ๐. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.
To help you identify the issue with your Java code, please provide the code for both the helper class and the main class.
I uploaded your attachments as Gist.
Problem with the code not running and instead giving me error
I think compiler will give you errors, you dont need to run it tho
Check those errors, they should be too clear
are you not getting any compile errors?
for variables?
cause they are not defined inside the class, they are local to functions
so, other functions cant access them
the errors are cannot find symbol for helper
this one from the main file
which ide u using?
Are both files in same package?
JGrasp
they should be
Never used JGrasp, but if you dont even make a package, like run in VS Code, it will run
I can see many problems with Helper file tho
Can you show, project explorer?
which shows hierarchy of files, i can say
can you show me wym
something like that
like this?
did you save ur helper file?? 
Try deleting CoinStarMain.class file and run again
Why are you not using an ide like IntelliJ?
because thats what the majority of ppl use in my school and also professors. and it has a 30 day trial
still an error
IntelliJ is completely free
There is a paid version but you won't need that ever
Anyways, the issue here is that CoinStarHelper is not compiled
You can see CoinStarMain has a .class file, but CoinStarHelper doesn't
yeah i see that since it couldnt run the code
no it doesnt, it gives me an error where it cannot find symbol
Show the error
So.. there is a lot of wrong code in your CoinStarHelper
You used a variable named TotalCost but it doesn't exist ( is it a function? because then it needs to be TotalCost()
And more
forgot to change that
the rest of the errors is about that the variables you try to print don't exist
numQ, numD, numN and numP
If you fix that and then compile both files again it should work
But the next step needs to be to download a proper IDE like IntelliJ
^^
It'll make your life alot easier
would that mean i did not declare them if it doesnt exist?
even vs code is much better than that -_-
but wouldnt recommend vsc for java
Yes, or maybe they are not in the scope you used them in
For example, if you declare them in an if statement, you can't use them outside of the if statement
public void myFunction(){ // Scope 1
int first = 0;
if (something){ // Scope 2
int second = 0;
first = 1; // Works
second = 1; // Works
}
first = 2; // Works
second = 2; // ERROR, that variable doesn't exist in this scope
}
yeah, me neither lol, but its surely better than jGrasp, Even I use intellij and Eclipse
well, all code is inisde a method, unless i would have to change the order
Except if you show the code
for installation options, would i have to check update path variable?
default options work, just click through
what is Project JDK is not defined?
It doesn't find a jdk and you have to tell it where it is
uhh ive never used this ide b4 so im kinda lost
Just google
jetbrains has a lot of articles on this stuff
@tidal sluice It's much easier if you follow through what tim suggested, usually IDE's have their own quick guides to set up everything you usually do.
Closed the thread due to inactivity.
If your question was not resolved yet, feel free to just post a message to reopen it, or create a new thread. But try to improve the quality of your question to make it easier to help you ๐