Computer Programming I :: Projects :: House Builder
Problem
Using object-oriented programming, you are going to create a program that can create and destroy houses with a given number of bedrooms and bathrooms. Make sure you look at the example to see what the final product should look like.
Your first step for this project should be to write an algorithm. This will be your longest algorithm so far in this class so it would help to break it up into the following parts:
- Set Properties: When you click on the button to create a new house, the form controls to set the number of bathrooms and bedrooms should appear along with a button to finalize the house creation.
- House Creation: Once you click the button to finalize house creation, a new house should be created using the House class and an image should appear representing that house in the correct location.
- House Destruction: The button that was used to create the house should be reused to destroy a house.
- House Information: Clicking on the picturebox of a house should display the number of bathrooms and bedrooms that house contains.
After writing your algorithm, you should create a House class that has the following:
- Two variables to store the number of bedrooms and bathrooms.
- A constructor to initialize the two variables.
- An accessor method to display the value of the two variables.
Specific Requirements
- Your form should have four buttons to click on to create the houses. When you click on one of the buttons two textboxes, two labels, and a button should appear to let you set the number of bedrooms and bathrooms for the new house.
- After you enter the number of bedrooms and bathrooms and click the newly-visible button, a picturebox should appear near the original button that was clicked to create a new house.
- After a new house is created its button should change to say "Destroy House," and clicking this button should remove the picturebox.
- Clicking on the picturebox of a house should call the house's accessor method to display the number of bedrooms and bathrooms in a MessageBox.
- Determine a good name for each variable following the rules.
- Rename the form and all controls on the form.
- Add color, font styles, and at least one picture to make your program look nice.
Tips
- You probably need a variable to keep track of which house button you clicked on when creating a new house.
- It may be helpful to use arrays to store the pictureboxes, House objects, and buttons.