No clue where to start: Real Estate Program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

No clue where to start: Real Estate Program

So there’s a challenge in a book I’m reading and I have no clue where to begin with this. Any help would be appreciated. Imagine you are investing in real estate and need to create a program to help track, estimate and/or manage costs related to a real estate property. Create the following private member variables: 1. property name/identifier 2. home sale price 3. HOA (home owners association) monthly cost 4. number of bedrooms 5. number of bathrooms 6. house square feet • Create accessor/mutator (get/set) functions for each member variable. Ensure that you use “const” where necessary. The property name is a string, so for the mutator/set function, the input parameter should be a reference to a string constant. • Create two constructors: one which does not take in any input parameters and assigns the numeric variables to 0 and string variables to empty string. A second (overloaded constructor) which takes in parameters for each variable and assigns the values passed in to the member variables. • Create a toString() method that returns a string which prints out all of the variable values of the this RealEstateProperty class. When calling this toString() function, the price per square feet should also be printed along with the other variable values. • Create a function named calculateMortgage() which calculates the mortgage monthly payment. The mortgage monthly payment (M) of a property is calculated as follows: 𝑀 = 𝑃 𝑟(1 + 𝑟)^n/ (1 + 𝑟)^n- 1 This function should output the monthly payment (M) and should have the following input parameters: down payment and monthly interest rate. Assume you will be paying the loan for 360 months. **Hint: use the Math library for exponent computation

10th Mar 2019, 7:37 PM
Charlie
Charlie  - avatar
18 Answers
+ 4
Where do you have problems? --> create a class/object --> insert all needed variables --> insert the two constructors --> insert setter/getter for each variable --> insert all methods you need Start with the stuff you know.
10th Mar 2019, 8:16 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
Access specifiers: https://www.sololearn.com/learn/CPlusPlus/1714/?ref=app (In java it is called setter and getter, sorry if I have confused you)
10th Mar 2019, 8:33 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
Can you post your code here on sololearn? (using the code playground)
10th Mar 2019, 9:29 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
The second part of your question: I think this what sneeze has written: "in your main class --> create a instance of your realEstate class" header file realEstate.cpp (realEstate class) main.cpp (main class, include header file, instance of realEstate class)
10th Mar 2019, 9:48 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
Now fill your realEstate with life. And implement the toString() method. So you can easily test your class.
10th Mar 2019, 9:58 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
Charlie But in principle, it's written like an instruction manual that you can work through step by step.
10th Mar 2019, 8:24 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
Charlie Yes. 6 setFunctions and 6 getFunctions.
10th Mar 2019, 9:12 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
Create a class that you call "realestate". Create a property in that class that is called "property_name" Make a property and private variable. In you main program Create a instance of your realestate class Assing a name to the "property_name" And print the name to the console. Hope this will get you started. Keep coding
10th Mar 2019, 8:12 PM
sneeze
sneeze - avatar
+ 1
I have an issue with the wording I guess, its a bit whelming.
10th Mar 2019, 8:18 PM
Charlie
Charlie  - avatar
+ 1
ive done the private member variables. how can i make a accessor/mutator function?
10th Mar 2019, 8:29 PM
Charlie
Charlie  - avatar
+ 1
So would I need to make set/get functions for every variable?
10th Mar 2019, 9:11 PM
Charlie
Charlie  - avatar
+ 1
it tells me “the header file should declare the class and its private member variables and member function prototypes/declarations.” what does that mean? also what does “The RealEstateProperty class function defintions should be implemented in a seperate .cpp”?
10th Mar 2019, 9:27 PM
Charlie
Charlie  - avatar
+ 1
thats part of the original question, i couldnt fit it since its quite big, I get that i need to declare a class in a header file. I also know i put the variables there, but im wondering if the set/get functions are include in the header file or in the .cpp file
10th Mar 2019, 9:31 PM
Charlie
Charlie  - avatar
0
ive made a main.cpp, RealEstateProperty.cpp and RealEstateProperty.h
10th Mar 2019, 9:52 PM
Charlie
Charlie  - avatar
0
how would i go aboht making the toString() method?
10th Mar 2019, 10:05 PM
Charlie
Charlie  - avatar
0
Hello Everyone I am Axel Blaze from Alpha Edge Infratech which is basically a real estate company from gurgoan..... Alpha Edge Infratech is a leading real estate consultancy firm that specializes in top projects in the industry. With years of experience in the field, the band has gained a deep understanding of the market and the needs of their clients. They provide a range of services, including property buying and selling, investment advice, and property management. If you have any questions related to our services, please visit our website or call us at +91-9009009728. residential properties in gurgaon: https://alphaedgeinfratech.com/properties/residential-property/ sco plots in gurgaon: https://alphaedgeinfratech.com/properties/sco-plots/ plots in gurgaon: https://alphaedgeinfratech.com/properties/plots-in-gurgaon/ Mapsko ASPR Hiils: https://alphaedgeinfratech.com/property/mapsko-aspr-hills/ Satya Merano Greens: https://alphaedgeinfratech.com/property/satya-merano-greens/ Vatika Xpressions: https://alphaedgeinfratech.com/property/vatika-xpressions/ Raheja Vanya 99: https://alphaedgeinfratech.com/property/raheja-vanya-99a/
29th May 2023, 5:59 AM
alpha edge
alpha edge - avatar