Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design a class House that defines a house on a street. A House has an int house number and an Point location. The key member

image text in transcribed

Design a class House that defines a house on a street. A House has an int house number and an Point location. The key member function is draw, which draws the house at location. The draw function should also write the house number on the house using the message object. Next, design a class Street. An object of type Street stores two House objects called first and last and the number of houses, num_houses, on the street which is an int. Street also has a member function called plot. Plot should draw evenly spaced houses starting at first ending with last. The number of houses plotted is equal to number of houses on the street. Use these classes in a graphics program in which the user clicks with the mouse on the locations of the first and last house, then enters the house numbers of the first and last house, and the number of houses on the street. Then the entire street is plotted Note: you will have to write constructors as well as number of helper member functions such as get first0 etc. If you think you will need a member function just write one Extra credit Each house has a chimney and produces smoke randomly. The smoke can be made up of small circles. Don't make the circles static, rather each circle should jump to a new location approzimately every half a second. Implemented in an inteligent way. (+lpts) . FAQ Q: Do we have to account for situation where number of houses entered is greater than the difference between the address of house and house 2. Eg what if house 1 has address 1 and house 2 has address 5 and we have 10 houses on the street. What should happen? Aui her or A: Yes. You wil have to account for this. Some houses will have the same house number. So if you have 10 houses and first house has number 1 and last house number 5. Then each time address changes by 4/9. This gives the house numbers: 1,1, 1,2,2,3,3,4 ,4-5 Q: Do we have to account for a situation where first house has a larger house number than the second house? A: Yes Q: Is it ok if the houses overlap? A: Yes Q: In the street class, is it necessary for the objects to store the the first house and the last house, or can they instead store the xy coordinates of the first and last houses? A: Street class has to have two houses Design a class House that defines a house on a street. A House has an int house number and an Point location. The key member function is draw, which draws the house at location. The draw function should also write the house number on the house using the message object. Next, design a class Street. An object of type Street stores two House objects called first and last and the number of houses, num_houses, on the street which is an int. Street also has a member function called plot. Plot should draw evenly spaced houses starting at first ending with last. The number of houses plotted is equal to number of houses on the street. Use these classes in a graphics program in which the user clicks with the mouse on the locations of the first and last house, then enters the house numbers of the first and last house, and the number of houses on the street. Then the entire street is plotted Note: you will have to write constructors as well as number of helper member functions such as get first0 etc. If you think you will need a member function just write one Extra credit Each house has a chimney and produces smoke randomly. The smoke can be made up of small circles. Don't make the circles static, rather each circle should jump to a new location approzimately every half a second. Implemented in an inteligent way. (+lpts) . FAQ Q: Do we have to account for situation where number of houses entered is greater than the difference between the address of house and house 2. Eg what if house 1 has address 1 and house 2 has address 5 and we have 10 houses on the street. What should happen? Aui her or A: Yes. You wil have to account for this. Some houses will have the same house number. So if you have 10 houses and first house has number 1 and last house number 5. Then each time address changes by 4/9. This gives the house numbers: 1,1, 1,2,2,3,3,4 ,4-5 Q: Do we have to account for a situation where first house has a larger house number than the second house? A: Yes Q: Is it ok if the houses overlap? A: Yes Q: In the street class, is it necessary for the objects to store the the first house and the last house, or can they instead store the xy coordinates of the first and last houses? A: Street class has to have two houses

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

Data Management Databases And Organizations

Authors: Richard T. Watson

2nd Edition

0471180742, 978-0471180746

More Books

Students also viewed these Databases questions