Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1:26 PM psu.instructure.com iPad Overall Problem You are playing the game of Mon

ID: 3747009 • Letter: 1

Question

1:26 PM psu.instructure.com iPad Overall Problem 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. To make the program simple, you may assume that you will not have enough money to build past four houses, so there needs to be no special cases for hotels. Courses 28 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 Calendar Inbox color size cost purple 2 50 light blue 3 50 maroon 3 100 orange 3 100 red yellow 3 150 green 3 200 dark blue 2 200 A Notices Help 3 150 Sample Interfaces which color block will you be building on? orange How much money do you have to spend? 860 There are 3 properties and each house costs 100 You can build 8 housels)1 will have 2 and 2 will have Which color block will you be building on? dark blue How much money do you have to spend? 250 There are 2 properties and each house costs 208 K-

Explanation / Answer

Solution:

//for sample interface

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")

// for extra credit option

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
c = input("How many houses are already present on these properties?")
d,e=c.split()
print("You can build "+str(int(m/50))+"house(s) -- 1 will have "+str(int(a)+int(d))+"and 1 will have "+str(int(b)+int(e)))
elif(color == "light blue"):
print("There are 3 properties and each house costs 50 ")
b = (m/50+1)/3
a = b-1
c = input("How many houses are already present on these properties?")
d,e=c.split()
print("You can build "+str(int(m/50))+"house(s) -- 1 will have "+str(int(a)+int(d))+"and 2 will have "+str(int(b)+int(e)))
elif(color == "maroon"):
print("There are 3 properties and each house costs 100 ")
b = (m/100+1)/3
a = b-1
c = input("How many houses are already present on these properties?")
d,e=c.split()
print("You can build "+str(int(m/100))+"house(s) -- 1 will have "+str(int(a)+int(d))+"and 2 will have "+str(int(b)+int(e)))
elif(color == "orange"):
print("There are 3 properties and each house costs 100 ")
b = (m/100+1)/3
a = b-1
c = input("How many houses are already present on these properties?")
d,e=c.split()
print("You can build "+str(int(m/100))+"house(s) -- 1 will have "+str(int(a)+int(d))+"and 2 will have "+str(int(b)+int(e)))
elif(color == "red"):
print("There are 3 properties and each house costs 150 ")
b = (m/150+1)/3
a = b-1
c = input("How many houses are already present on these properties?")
d,e=c.split()
print("You can build "+str(int(m/150))+"house(s) -- 1 will have "+str(int(a)+int(d))+"and 2 will have "+str(int(b)+int(e)))
elif(color == "yellow"):
print("There are 3 properties and each house costs 150 ")
b = (m/150+1)/3
a = b-1
c = input("How many houses are already present on these properties?")
d,e=c.split()
print("You can build "+str(int(m/150))+"house(s) -- 1 will have "+str(int(a)+int(d))+"and 2 will have "+str(int(b)+int(e)))
elif(color == "green"):
print("There are 3 properties and each house costs 200 ")
b = (m/200+1)/3
a = b-1
c = input("How many houses are already present on these properties?")
d,e=c.split()
print("You can build "+str(int(m/200))+"house(s) -- 1 will have "+str(int(a)+int(d))+"and 2 will have "+str(int(b)+int(e)))
elif(color == "dark blue"):
print("There are 2 properties and each house costs 200 ")
b = (m/200+1)/2
a = b-1
c = input("How many houses are already present on these properties?")
d,e=c.split()
print("You can build "+str(int(m/200))+"house(s) -- 1 will have "+str(int(a)+int(d))+"and 1 will have "+str(int(b)+int(e)))
else:
print("Wrong input")

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote