samedi 6 avril 2019

Creating a if statement which needs to have 2 other statements depending on the original one

I'm trying to create a monopoly game. When the player lands on a lot (21). The player needs to either pay a minimum of £200 or 10% of their worth.

I've played around with a little bit of code as shown below. However it keeps showing up with error messages.

{
if  (contestants[i].position == 21 )
                         percentage = contestants[i].balance/10;
                    {
                     if (percentage >=200)
                            contestants[i].balance= contestants[i].balance -percentage;
                    }
                    {
                    else  (percentage <=199)
                        contestants[i].balance = contestants[i].balance - 200; 

                    }

Aucun commentaire:

Enregistrer un commentaire