In: Computer Science
Overall Problem (Must be coded in a beginners level python code)
You are playing the game of Monopoly and you decide you wish to construct houses on one of your property groups. The rules of the game require that the number of houses on the properties within each group may not differ by more than one.
You will be given an amount of money to spend, the cost per house, and the number of properties in the group. The goal is to determine how many houses will go on each. And to appear more conversational, the last line of output will use words to represent numbers instead of digits.
To make the program simple, you may assume that you will not have enough money to build past four houses per property (twelve total). You do not need to convert the price of a house to a word (although that can be done rather simply).
Monopoly Property Groups
Here is a small table relating the colors of the monopoly property groups, the number of properties within the group, and the cost of the houses.
color | size | cost |
purple | 2 | 50 |
light blue | 3 | 50 |
maroon | 3 | 100 |
orange | 3 | 100 |
red | 3 | 150 |
yellow | 3 | 150 |
green | 3 | 200 |
dark blue | 2 | 200 |
color = input("Which color block will you be building on?
")
m = int(input("How much money do you have to spend? "))
if(color == "purple"):
print("There are 2 properties and each house costs 50 ")
b = (m/50+1)/2
a = b-1
print("You can build "+str(int(m/50))+" house(s) -- 1 will have
"+str(int(a))+"and 2 will have "+str(int(b)))
elif(color == "light blue"):
print("There are 3 properties and each house costs 50 ")
b = (m/50+1)/3
a = b-1
print("You can build "+str(int(m/50))+" house(s) -- 1 will have
"+str(int(a))+"and 2 will have "+str(int(b)))
elif(color == "maroon"):
print("There are 3 properties and each house costs 100 ")
b = (m/100+1)/3
a = b-1
print("You can build "+str(int(m/100))+" house(s) -- 1 will have
"+str(int(a))+"and 2 will have "+str(int(b)))
elif(color == "orange"):
print("There are 3 properties and each house costs 100 ")
b = (m/100+1)/3
a = b-1
print("You can build "+str(int(m/100))+" house(s) -- 1 will have
"+str(int(a))+"and 2 will have "+str(int(b)))
elif(color == "red"):
print("There are 3 properties and each house costs 150 ")
b = (m/150+1)/3
a = b-1
print("You can build "+str(int(m/150))+" house(s) -- 1 will have
"+str(int(a))+"and 2 will have "+str(int(b)))
elif(color == "yellow"):
print("There are 3 properties and each house costs 150 ")
b = (m/150+1)/3
a = b-1
print("You can build "+str(int(m/150))+" house(s) -- 1 will have
"+str(int(a))+"and 2 will have "+str(int(b)))
elif(color == "green"):
print("There are 3 properties and each house costs 200 ")
b = (m/200+1)/3
a = b-1
print("You can build "+str(int(m/200))+"house(s) -- 1 will have
"+str(int(a))+"and 2 will have "+str(int(b)))
elif(color == "dark blue"):
print("There are 2 properties and each house costs 200 ")
b = (m/200+1)/2
a = b-1
print("You can build "+str(int(m/200))+"house(s) -- 1 will have
"+str(int(a))+"and 1 will have "+str(int(b)))
else:
print("Wrong input")