Put the class definition in House.h and the implementation of the constructors and functions in House.cpp 1. Define a class called "House", that represents the information of a house. A House is defined with these attributes: age (int), type (string) (for example Detached, Semi-Attached, Attached) and build_cost (double). Functions of the House class must perform the following operations: ✓ A default constructor which sets all the numeric instance variables to zero and the String instance variables to empty String. ✓ A constructor with 3 parameters which sets the 3 instance variables to the corresponding values passed. ✓ Implement a getter function for each of the 3 instance variables that will return the value of the instance variable. For example, the getX() function for the instance variable type must be called getType(). ✓ Implement a setter function for each instance variable that will assign to the instance variable to the value passed. For example, the setX() function for the instance variable type must be called setType(). ✓ An Estimate Price function: This function estimates the price of a house based on the build_cost and age. The house price is increased by 1% of the build_cost yearly. For example if the build_cost for a house is 100000 and the age of this house is 2, the EstimatPrice() function returns 102000 (100000+2* (0.01*100000)) ✓ A Similar function: This function has one input parameter which is a pointer to a House object. This function compares two houses and it returns true if both of them have the same age and type. ✔ A ComparePrice function: This This function has one input parameter which is a pointer to a House object. This function compares the price of two houses (using the Estimate Price function) and returns a string based on the comparison results as follows: - If the price of the first house is higher, ComparePric function returns this string: House 1 is more expensive" - If the price of the second house is higher, ComparePric function returns this string: House 2 is more expensive"
Put the class definition in House.h and the implementation of the constructors and functions in House.cpp 1. Define a class called "House", that represents the information of a house. A House is defined with these attributes: age (int), type (string) (for example Detached, Semi-Attached, Attached) and build_cost (double). Functions of the House class must perform the following operations: ✓ A default constructor which sets all the numeric instance variables to zero and the String instance variables to empty String. ✓ A constructor with 3 parameters which sets the 3 instance variables to the corresponding values passed. ✓ Implement a getter function for each of the 3 instance variables that will return the value of the instance variable. For example, the getX() function for the instance variable type must be called getType(). ✓ Implement a setter function for each instance variable that will assign to the instance variable to the value passed. For example, the setX() function for the instance variable type must be called setType(). ✓ An Estimate Price function: This function estimates the price of a house based on the build_cost and age. The house price is increased by 1% of the build_cost yearly. For example if the build_cost for a house is 100000 and the age of this house is 2, the EstimatPrice() function returns 102000 (100000+2* (0.01*100000)) ✓ A Similar function: This function has one input parameter which is a pointer to a House object. This function compares two houses and it returns true if both of them have the same age and type. ✔ A ComparePrice function: This This function has one input parameter which is a pointer to a House object. This function compares the price of two houses (using the Estimate Price function) and returns a string based on the comparison results as follows: - If the price of the first house is higher, ComparePric function returns this string: House 1 is more expensive" - If the price of the second house is higher, ComparePric function returns this string: House 2 is more expensive"
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 7SA: Assume the definition of class foodType as given in Exercise 6. Answer the following questions? (1,...
Related questions
Question
100%
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning