DOM Tutorial Monopoly Questions (Medium)
These question concern the monopoly documents. Your code is tested against three different documents http://progzoo.net/monopoly1.xml http://progzoo.net/monopoly2.xml and http://progzoo.net/monopoly3.xml
<!DOCTYPE game SYSTEM "monopoly.dtd"> <game> <board> <square label='GO'> <player id='dog' cash='1500'/> <player id='ship' cash='1500'/> <player id='iron' cash='1500'/> </square> <square label='Old Kent Road' ref='old-kent-road'/> <square label='Community Chest'/> <square label='Whitechapel' ref='whitechapel'/> <square label='Income Tax (Pay 200)'/> <square label="King's Cross Station" ref='kings-cross'/> </board> <bank> <property id='old-kent-road' price='60' colour='brown'/> <property id='whitechapel' price='60' colour='brown'/> <station id='kings-cross' price='200'/> </bank> </game>
How many properties?
Show the number of properties held by player "ship" (count only property - not stations)
Move dog 3
Player dog throws a 3. Give the label of the square he will land on.
If one player holds all properties that are light-blue then give the id of that player. Otherwise give "none".
King's cross rent
State the amount due in rent if you land on kings-cross.If the owner of kings-cross has 1 station pay 25, if he has 2 stations pay 50, if 3 stations then 150, if 4 stations pay 200. If the station is owned by the bank pay 0.
Dog buys property
Player "dog" throws a 5, lands on a property and buys it. Update the game document to reflect the new state of play.