Else If Statement

0 L Ze · May 26, 2015

I'm creating a simple game in Netbeans but I've come across a problem, when I've 500 coins and I try to add more, the total coins value will go to -1 therefore I think I need a else if statement in my code to stop and display a error message but I'm not sure how to write it?

http://ultraimg.com/images/ex136c6.png

http://ultraimg.com/images/ex4d21e.jpg

Post a Reply

Replies

Oldest  Newest  Rating
+1 Garrett Gillette · May 26, 2015
change ocoin < 500 to (ocoin < 500 && totalcoins >= 1)
0 L Ze · May 26, 2015
Thanks Garrett, that has worked however is it possible to have another display message box for (ocoin < 500 && totalcoins >= 1) such as you can't take anymore coins instead of using the one I already have you have reached the limit?
  • 1

Java / Android Development

107,243 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator