What should I do to make this code workable other than just copy and paste? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What should I do to make this code workable other than just copy and paste?

public boolean getIntoStanford(double gpa, boolean isGates, boolean isVader) { if (!isVader && (gpa>=3.95 || (gpa>=1.0 && isGates))) { return true; } else { return false; } } Assign the class name to getIntoStanford? Assign value to gpa, isGates and isVader? I just learned until boolean. I think there is a misunderstanding of concept here. 😅

3rd Feb 2019, 3:30 PM
GO!
GO! - avatar
2 Answers
+ 5
I'm not sure what you mean by "workable other than copy and paste", the thing I noticed here was that the getInfoStanford method isn't a member of a class, you need to put that method in a class to get it running. Here are some steps you can do to make the code run: First you create a class, if you write in Code Playground you'll be provided an empty class when you create new code, you can do with that. Next copy that method and paste it in the class' body, as a member of the class, remember not to put it inside the main method. Finally you call the method from inside the main method, passing the necessary values as arguments, and have a variable of type boolean ready to receive the returned value, or you can directly print the return value, your choice.
3rd Feb 2019, 6:08 PM
Ipang
+ 1
Oh thanks! Since I haven't learned class yet, I think I should go through the course first.
7th Feb 2019, 12:30 AM
GO!
GO! - avatar