+ 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
27 Respostas
+ 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
Home Loans http://interest.mortgage/ Starting out felt overwhelming, but this Real Estate Program really simplified everything. The guidance on Home Loans was a game changer—clear, practical, and easy to follow. If you're clueless like I was, this is the perfect first step. Highly recommend diving into it confidently!
6th Aug 2025, 6:48 PM
arman ali