Question: CODE IN C++ A house contains necessary information like floor number, space in meters squared, price per meter squared and an address. Those information are
CODE IN C++
A house contains necessary information like floor number, space in meters squared, price per meter squared and an address. Those information are private. If a user wants to access or change details about the house, they would have to use setter or getter methods. Example: set_floor(int) takes the floor number from the user and sets it to the private variable floor in the House. A house has a method called calculate_total() that uses the house information to calculate the total price of the house based on the space and price per meter squared. The calculated total should be set to a private variable called total_price in the class that doesnt have a setter function.
1. Given the description above, write a C++ class for the House with the attributes and the necessary methods.
2. In your main function, write a C++ program that takes the information of 5 houses from a user and prints the information of the house with the lowest total price. It is possible to achieve the same by creating a class called House_Comparison that has -but not limited to- this function.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
