# Yorkville High School Computer Science

ASSIGNMENTS: No Current Assignments

## Computer Programming I :: Projects :: House Builder

Rubric
Lesson
Example
Due: May 22

### 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:

1. 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.
2. 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.
3. House Destruction: The button that was used to create the house should be reused to destroy a house.
4. 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

1. 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.
2. 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.
3. After a new house is created its button should change to say "Destroy House," and clicking this button should remove the picturebox.
4. 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.
5. Determine a good name for each variable following the rules.
6. Rename the form and all controls on the form.
7. 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.