Question
C++ program that I finished most of but I get errors. Please reply with a version that I can copy paste and run. I believe
C++ program that I finished most of but I get errors. Please reply with a version that I can copy paste and run. I believe I need the header file for string. #include . or change string to char array as char City[50], agent[50]. Help would be greatly appreciated
class realEstate{ private: //declare the member variables string City; string agent; double price; int sq_foot_masterbedroom; int sq_foot_smallbedroom; int sq_foot_livingroom; int total_footage; bool basement; float no_baths; public://declares and defines the member function of the class //accepted argument values are stored in the private members of the class void SetInfo(string City,string agent,double price,int sq_foot_masterbedroom,int sq_foot_smallbedroom, int sq_foot_livingroom, bool basement,float no_baths){ this->City = City; this->agent=agent; this->price = price; this->sq_foot_masterbedroom = sq_foot_masterbedroom; this->sq_foot_smallbedroom = sq_foot_smallbedroom; this->sq_foot_livingroom= sq_foot_livingroom; this->basement= basement; this->no_baths= no_baths; } //calculates the total footage void CalcSquareFootage(){ total_footage = sq_foot_masterbedroom+sq_foot_smallbedroom+sq_foot_livingroom; } //displays the information void PrintInfo(){ cout
Your Task: Write a class for use in a real estate program to represent a two.bedroom home on the market. Your class should have private data members to represent the following characteristics. It is up to you to choose the appropriate data types City where the house is located The real estate agent handling the house The list price of the home (e.g. $249,000.00) The square footage of the master bedroom The square footage of the small bedroom The square footage of the living room Total square footage (which will be the sum of the square footage of the master bed, smaller bed, and living room) A Boolean value indicating whether or not there is a basement The number of baths (Note: This can be a decimal number, e.g. 1.5) Additionally, your class should have the following public member functions A "Setlnfo" function that allows you to put meaningful values into the all private data members EXCEPT the total square footage (which you will calculate in a separate function). Do not rely on cout/cin statements to populate the private data members from inside this member function. I expect you to PASS these values as arguments from main. Note: you may pass constants to the SetInfo function, thus bypassing user input. If you opt to incorporate user input, you should avoid using spaces in the city name (just use "Worth") and the realtor's name (first name only will do). The reasons for this will be apparent in our next chapter A CalcSquareFootage function which will calculate the combined square footage for both bedrooms and the living room and then put that sum into the total square footage private data member. Note: DO NOT define any new variables in this function (nor should this function accept any arguments from main). Instead, USE the private data members. This function should consist of just one line -your arithmetic operation and the assignment to the total square footage A PrintInfo function which will print the values on the screen according to the required output (next page) In main, create an object based on your class and call your member functions in the order listed above, making sure to provide arguments for the SetInfo function. Required Output City: Palos Hills Master Bedroom: 144 sq. ft Small Bedroom: 100 sq. ft Living Room 270 sq. ft Total Square Footage: 514 Baths: 1.5 Basement: YesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started