I’m writing a program that has a cap on how many visitors etc. And if it reaches cap then it defaults and prints i.e. You have reached adult capacity.
I am looking for a way to shorten my code and not use stacked if statements (which I am using now. I am very new at this and I was hoping there was a way to do that by implementing the following? However I’m not quite seeing how to get it to recognize and System.out.print specifics.
if (childCount >= CHILD_LIMIT || adultCount >= ADULT_LIMIT
|| seniorCount >= SENIOR_LIMIT || totalPeople >= TOT_LIMIT || totalMoney >= GRAND_AMT)
If you are trying to print different statements for different conditions, you should use separate
ifstatements: