mercredi 19 février 2020

How can I make it so my integer from earlier change numbers if something happens?

I am in a basic computer programming class in High School, and my teacher is no help. I want to make 3 numbers entered by the user to change to 5 if the total is greater than 15. So far I've learned:

if (g + h + i > 15)
else

I've also learned int g = console.nextInt(); to get the user to type a number.

What I can't figure out is how to get all 3 integers entered by the user to change to 5 if their total greater than 15. I can get text to appear saying the number 5 or that all numbers are now 5, but i want the text from earlier to change. Is this possible?

Thanks so much for the help. I know this is probably a very easy thing to do, but I appreciate it none the less.

Aucun commentaire:

Enregistrer un commentaire