Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment provides more practice in basic calculations, and also introduces the use of data structures to hold information used in solving the problem. These

image text in transcribedimage text in transcribedimage text in transcribed

This assignment provides more practice in basic calculations, and also introduces the use of data structures to hold information used in solving the problem. These data structures will be initialized within the program source code, and consulted after the input arrives. Since the problem is a little more complicated than the previous homework, every student should still follow the recommended schedule described in the previous assignment for getting particular phases accomplished ahead of time. 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, and the color Monopoly uses on the game board for a group of properties (see chart below). 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. size cost color purple light blue 50 2 3 50 maroon 3 100 100 3 orange red 150 yellow 3 3 3 2 150 200 green dark blue 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? yellow How much money do you have to spend? 660 There are three properties and each house costs 150 You can build four house(s) -- two will have one and one will have two Which color block will you be building on? maroon How much money do you have to spend? 660 There are three properties and each house costs 100 You can build six house(s) -- three will have two and none 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 Exact spacing and spelling is not required -- correct calculation is far more important. All five computed values in that last output line must be present and correct. It is expected that lists and dictionaries will be sufficient for this entire problem. There should be nothing from later in the course. Code that uses if- statements or loops from Unit 3 will not earn a grade for this assignment. Extra Credit Option When strings are provided as input instead of numbers, sometimes a valid input is not quite recognized as what the user intended. There may be extra space characters before or after the input; or a user might capitalize a letter that was not expected. This can often prove to be very frustrating to that keyboard user, if he consistently types 'Red' as a color and is told that the input is incorrect, or if something about the prompt lures him into typing a space first ('red' and 'red' are not considered by Python to be the same as 'red') The string object (str) in Python has some functions that can help with that. The most direct way to find that information is to go into Python IDLE and The string object (str) in Python has some functions that can help with that. The most direct way to find that information is to go into Python IDLE and type help(str) Two of the three most helpful methods will be in the latter part of that very long list (on the last screenful or two). If you use them to reinterpret the input data, then you can be more flexible on what inputs are accepted. Incidentally, Cengage Unit 4.4 talks about string methods and how to use them (which can be informative), but it turns out that the short list of examples they use to illustrate does not include any of the functions that help with this particular problem. Extra Credit Option Use the features of the Python language to show the colors to choose from. They should appear all in a row, separated by commas, and without any enclosing punctuation (1).0. or ) appearing. Do so without either (1) writing those colors directly into the print statement or (2) using any loop from later in the course. Instead, for any credit the program code must use features of the Python language to display the choices, as they appear in the data you use for the rest of the program. For example, The block colors in Monopoly are: purple, light blue, maroon, orange, red, yellow, green, dark blue Which color block will you be building on? dark blue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

What is loss of bone density and strength as ?

Answered: 1 week ago

Question

The paleolithic age human life, short write up ?

Answered: 1 week ago

Question

3. You can gain power by making others feel important.

Answered: 1 week ago