Template Method Lab 1
Objective - complete the following instructions to add another concrete class to the house building example using the Template Method pattern:
Assignment: Implement a New Type of House
You have been given an existing house building system that uses the Template Method pattern. The system currently supports building wooden houses and brick houses. Your task is to extend the system to include a new type of house: a stone house.
Requirements:
Implement a new class called
StoneHouseBuilder
that extends theHouseBuilder
abstract class.Provide implementations for the abstract methods defined in the
HouseBuilder
class to build a stone house. You should define the steps for building the foundation, structure, roof, walls, and furnishing the stone house.Add any additional methods or attributes that are specific to building a stone house.
Test your implementation by creating a new instance of the
StoneHouseBuilder
class and calling thebuildHouse()
method. Ensure that the stone house is built correctly by verifying the output messages.
Note:
You can assume that the existing classes (
HouseBuilder
,WoodenHouseBuilder
, andBrickHouseBuilder
) are already implemented correctly.You can use the existing code provided in the previous example as a reference for your implementation.
Submission:
Submit the modified
StoneHouseBuilder
class as a separate file or as part of the existing project.Include any additional instructions or notes necessary for running and testing your code.
Good luck with your assignment!