Question

You are playing the game of Monopoly and you decide you wish to construct houses on...

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

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

Sample Interfaces:

Which color block will you be building on?  orange
How much money do you have to spend?   860
There are three properties and each house costs 100 
You can build eight house(s) -- one will have two and two will have three
Which color block will you be building on?  dark blue 
How much money do you have to spend?  250
There are two properties and each house costs 200
You can build one house(s) -- one will have none and one will have one

The information above relates to a previous homework assignment. Below is the continuation of that assignment but in more detail. This is the part I need help with.

The previous assignment had a simplifying assumption that the amount of money would be limited, such that the builder could not afford more than four houses on any property. This assignment will lift that restriction.

There is nothing really special about building hotels in Monopoly. That purchase is simply equal to the price of five houses, and is built only in the same circumstances that would permit five houses (no other property may have fewer than four).

The inputs to the program will be essentially the same -- the color of a property group and the amount of money to be spent. But the following cases should be addressed:

  • if no building is affordable, display "You cannot afford even one house." instead of building 0 houses everywhere.
  • if one can afford to build 5 houses somewhere, announce that a hotel is being built instead of 5 houses.
  • if one can afford to build more than 5 houses somewhere, only build one hotel and nothing else
  • omit the word 'none' in the output (i..e don't say 'one property has none' or 'none have two')

Hint: The simplest and clearest solutions will use 'else' and 'elif' and will not need 'and' or 'or'.
A portion of your grade is based on how clear your code is, and how well it avoids producing contradictory output.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

As per the given details the program should be as follows :

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

HOPE THIS MAY HELP YOU---

THANK YOU ……. PLEASE LIKE,IT WILL INCREASE MY SCORE,

HOPE YOU WILL ENCOURAGE ME…..

Add a comment
Know the answer?
Add Answer to:
You are playing the game of Monopoly and you decide you wish to construct houses on...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • As a real estate investor, you want to maximize your profit by buying and renting houses....

    As a real estate investor, you want to maximize your profit by buying and renting houses. You have exactly 8 alternatives which will be given in a format as below. Write a VBA code that maximize your monthly rent with the following constraints: - You can buy the houses within the given budget (in Cell B6). - You can't buy more than 5 houses. Each house is unique. - You give a cleaning service with a limited capacity, so total...

  • For this section, write whether the statements are True or False or Uncertain (if you say...

    For this section, write whether the statements are True or False or Uncertain (if you say uncertain, have enough evidence to back your answer just as much as the true or false responses). Explain your answer and use diagrams where necessary. (a) A uniform monopolist has an upward sloping MC curve. Claim: A price ceiling set below the monopoly price will increase welfare more than monopoly profits. Assume no shut down of the monopoly. (b) A consumer with perfectly inelastic...

  • Please help! Finance question on EFFICIENTLY INEFFICIENT(concept question) Question background: Suppose that you are considering buying...

    Please help! Finance question on EFFICIENTLY INEFFICIENT(concept question) Question background: Suppose that you are considering buying a home, which you expect to live in for about 5 years, and, given the mobile workforce in Hong Kong, you also expect future buyers of the property to move relatively frequently. You find a house and an apartment which are equally attractive and consider which one to buy. (The house and apartment are equally attractive in the sense, for instance, that something similar...

  • You are asked you to compare the experience of playing the game of Slither snake on...

    You are asked you to compare the experience of playing the game of Slither snake on a PC with playing on a cell/smart phone. For this assignment, I want you to consider the pros and cons of playing the same game using different interfaces. (e.g. tangible, wearable, and shareable) and describe how the game could be redesigned for each of these, taking into account the user group being targeted. For example (just examples, you can think of more) the tangible...

  • Hope you can answer them, thank you QUESTION 13 Your client has a gut feeling (she...

    Hope you can answer them, thank you QUESTION 13 Your client has a gut feeling (she uses the force) that the average house price in Lincoln Dark is $450K. You decide to use the previously collected data. Your sample size is 25 houses. The average based on the sample is $500K. The sample standard deviation is $100K. Test the hypothesis that the average house price in Lincoln Dark is $450K against the alternative that it is not. Use alpha 10%....

  • Emma Jones is planning to move this coming summer to Oxford, MS to start her new...

    Emma Jones is planning to move this coming summer to Oxford, MS to start her new job at a technology firm. She has not yet decided whether she wants to rent or buy a property here in Oxford and she is asking your team to help her make this financial decision. Her monthly budget is $1,500 to cover any housing expenses including rent or owners’ costs (example: mortgage, hazard insurance, property taxes, and Home Owner Association fees). A good start...

  • A ship is carrying 30 travelers from various great houses on a long sea voyage from...

    A ship is carrying 30 travelers from various great houses on a long sea voyage from Braavos to King’s Landing where they will participate in the Game of Thrones: 5 are from House Targaryen(TAR), and 5 from House Lannister (LAN) 4 are from House Stark (STA) and 4 from House Tyrell (TYR) 3 are from House Baratheon (BAR) and 3 from House Martell (MAR) 1 from each of the following houses: House Arryn (ARR), House Tully (TUL), House Greyjoy (GRE),...

  • Now pretend that it is 2005 and you just graduated from college, got married, and landed...

    Now pretend that it is 2005 and you just graduated from college, got married, and landed an entry-level job in one of the booming economies of Southern California, Nevada, or Florida. You like your apartment but keep reading about low interest rate home loans that are available to people who have not saved up the “old-fashioned” 20% down payment. You also vividly remember messages from your childhood telling you that renting is a waste of money because it does not...

  • A ship is carrying 30 travelers from various great houses on a long sea voyage from...

    A ship is carrying 30 travelers from various great houses on a long sea voyage from Braavos to King’s Landing where they will participate in the Game of Thrones: 5 are from House Targaryen(TAR), and 5 from House Lannister (LAN) 4 are from House Stark (STA) and 4 from House Tyrell (TYR) 3 are from House Baratheon (BAR) and 3 from House Martell (MAR) 1 from each of the following houses: House Arryn (ARR), House Tully (TUL), House Greyjoy (GRE),...

  • Imagine that you wish to compare a sample mean to a population mean to decide if...

    Imagine that you wish to compare a sample mean to a population mean to decide if you can reject the hypothesis that µ1= µ2. Assume that you have the following information: N = 45, M = 10, σ (sigma) = 2, µ = µM= 8. Which of the following types of tests should you use? Group of answer choices A) A z test B) A one-sample t test C)A paired-samples t test D) An independent-samples t test E) None of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT