Starting from:
$30

$24

Lab 07 Solution

Objectives:







Class and Data Abstraction



Implement a user defined class



Separate Class declaration and definition






Question 1:







On blackboard, you will find files named “Question1.cpp”. It uses a House class which has not yet been defined. It is your task to define the class within the Question1.cpp file for use within the main block. You will need the following:




A default and parameterized constructor



Methods to get and set the number of bedrooms, bathrooms, parking spots, and the year the house was built.



Private members to store the state for each of the data items.



The output should match the example below.




Example 1:




How many bedrooms does your house have? 5




How many bathrooms does your house have? 2




How many cars fit in your garage? 1




What year was your house built? 2010




Your house has 2 more bedrooms




Your house has 1 more bathrooms




Your garage holds 2 fewer cars




Your house was built 9 years after my own.

More products