There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
Agree with a comment or answer? Like () to up-vote the contribution!
I was curious if the following would be a better way to write this code? Is it a better practice to always have a changeable variable that you use in calculations rather than using specific numbers?
At the bottom of the exercise, there should be a “Copy to Clipboard” button. Click it to copy your code. To paste your code in the forums with proper formatting, see: [How to] Format code in posts
Perhaps it will reveal clues as to why your attempted solution isn’t working.
Since you have already added a space after the word friend, there is no need for an extra space " "
// You wrote:
System.out.println("I gave each friend " + " " + amountForEachFriend + "...");
// It should be:
System.out.println("I gave each friend " + amountForEachFriend + "...");
Also,
// You wrote:
boolean canPurchaseTicket = amountForEachFriend >= 50
// It should be:
boolean canPurchaseTicket = amountForEachFriend >= 250