Real estate management system

I really need help with this please help me out thanks . I'm trying to make real estate management program for my final project.

#include <string>

#include <iostream>




using namespace std;





int main()



{

int choice,select, PropertyNumber, YearBuilt, ZipCode, Bedrooms,Type, Stories, MaxOccupancy,style,Marketvalue;

double RentPerSquareFoot, Bathrooms;

string Style, StreetAddress, City, State;

char Condition,cont;



do

{

system("cls");



cout <<"- Real Estate Program -\n\n"

<<" 1.Enter new listing\n"

<<" 2.Print listing\n"

<<" 3.Delete listing\n"

<<" 4.Save listing briefs to file \n\n"

<<"Enter Selection: ";



cin>> choice;

switch(choice)

{

case 1 : {

cout<< "Select 1 for Residential or 2 for Commercial\n";

cin>> select;

if (select == 1);

cout<< "What is the style?\n?";

cin>> style;



cout<< "What is the Property Number?\n";

cin>> PropertyNumber;





cout<< "What is the Street Address?\n";

cin.clear();

fflush(stdin);

getline(cin, StreetAddress);



cout<< "What City is it in?\n";

cin.clear();

fflush(stdin);

getline(cin, City);



cout<< "What state is it in?\n";

cin.clear();

fflush(stdin);

getline(cin, State);

cout<< "What is the zip code of the property\n?";

cin>>ZipCode;



cout<< "How many Bedrooms does the property have?\n";

cin>> Bedrooms;



cout<< "How many bathrooms does the property have?\n?";

cin>>Bathrooms;



cout<< "How many stories is the property?\n?";

cin>> Stories;



cout<< "What condition is the property in?\n" ;

cin>> Condition;



cout<< "What year was the property built?\n";

cin>>YearBuilt;



cout<< "What is the Market Value of the property?\n";

cin>> Marketvalue;



Type=1;



}





}



} while(cont == 'y' || cont == 'Y');





do

{

// system("cls");



cout <<"Enter (C) to continue or (Q) to quit. ";

cin >> cont;

}

while(cont == 'y' || cont == 'Y');

// system("pause");

return 0;

};
I'm trying to run all four menu thanks I will be really appreciate :)
That's a another one I did still figuring out. I need help please please

#include <string>
#include <iostream>

#include "property.h"
#include "commercial.h"
#include "residential.h"
using namespace std;


int main()

{
int Choice,select, PropertyNumber, YearBuilt, ZipCode, Bedrooms,Type, Stories, MaxOccupancy,style,Marketvalue;
double RentPerSquareFoot, Bathrooms;
string Style, StreetAddress, City, State;
char choice, Condition,cont;

do
{
system("cls");

cout <<"- Real Estate Program -\n\n"
<<" 1.Enter new listing\n"
<<" 2.Print listing\n"
<<" 3.Delete listing\n"
<<" 4.Save listing briefs to file \n\n"
<<"Enter Selection: ";

cin>> choice;
switch(choice)
{
case 1:
{
cout<< "Select 1 for Residential or 2 for Commercial\n";
cin>> select;
if (select == 1);
cout<< "What is the style?\n?";
cin>> style;

cout<< "What is the Property Number?\n";
cin>> PropertyNumber;


cout<< "What is the Street Address?\n";
cin.clear();
fflush(stdin);
getline(cin, StreetAddress);

cout<< "What City is it in?\n";
cin.clear();
fflush(stdin);
getline(cin, City);

cout<< "What state is it in?\n";
cin.clear();
fflush(stdin);
getline(cin, State);
cout<< "What is the zip code of the property\n?";
cin>>ZipCode;

cout<< "How many Bedrooms does the property have?\n";
cin>> Bedrooms;

cout<< "How many bathrooms does the property have?\n?";
cin>>Bathrooms;

cout<< "How many stories is the property?\n?";
cin>> Stories;

cout<< "What condition is the property in?\n" ;
cin>> Condition;

cout<< "What year was the property built?\n";
cin>>YearBuilt;

cout<< "What is the Market Value of the property?\n";
cin>> Marketvalue;

Type=1;

}
//blah
break;
case 2://blah
break;
case 3://blah
break;
case 4://blah
break;
default:
break;


}

} while(cont == 'y' || cont == 'Y');


do
{
system("cls");

cout <<"Enter (C) to continue or (Q) to quit. ";
cin >> cont;
}
while(cont == 'y' || cont == 'Y');
system("pause");
return 0;
};


////////////////////////
Poperty.h
#pragma once
#include "property.h"
#include <string>
using namespace std;

class Property
{
//member variables:
protected:
int PropertyNumber; //a unique 7 digit number to reference the property
string Address; //street address
string City, State, ZIPCode;
int Stories; //number of stories
int Condition ;// condition of the property (1 - Excellent, 2 - Fair, 3 ? Poor)
int YearBuilt; //the year the property was built
double MarketValue; // the current market value of the property ($)
int type; //1 for residential, 2 for commercial. No setter needed
//member functions:
public:
//Constructors ? Optional
Property(int pN, string add, string cty, string st, string z,
int str, int c, int y, double mv, int t)
{
PropertyNumber = pN;
Address = add;
City = cty;
State = st;
ZIPCode = z;
Stories = str; //number of stories
Condition = c;// condition of the property (1 - Excellent, 2 - Fair, 3 ? Poor)
YearBuilt = y; //the year the property was built
MarketValue = mv; // the current market value of the property ($)
type = t; //1 for residential, 2 for commercial. No setter needed
}


//getters and setters for member variables
int getPropertyNumber(){return PropertyNumber;} //a unique 7 digit number to reference the property
string getAddress(){return Address;} //street address
string getCity(){return City;}
string getState(){return State;}
string getZIPCode(){return ZIPCode;}
int getStories(){return Stories;} //number of stories
int getCondition(){return Condition;}// condition of the property (1 - Excellent, 2 - Fair, 3 ? Poor)
int getYearBuilt(){return YearBuilt;} //the year the property was built
double getMarketValue(){return MarketValue;} // the current market value of the property ($)
int gettype(){return type;}

virtual void print(){} //? this function should be overridden by the child classes but can be implemented to avoid redundancy
virtual double calculatePropertyTaxes() {return 0;} // this function should be overridden by the child classes for now just return
virtual double calculateRent(){return 0;} // this function should be overridden by the Commercial class for now just return 0
};
What help do you need ?
Does your program compile?
If not, what are the errors?
If it does compile, does the program not run as expected?
Tell us what happens and what is supposed to happen,
as well as what you've done to try and understand what's causing the problem.
Nobody here is going to write you final project for you. We will, however, help you when you get stuck.

You seem to have written part of menu item 1.

I would highly recommend that you split your functionality into functions. Then your switch statement would become something like:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
cin>> choice;
switch(choice)
{
    case 1:
        addListing(/* arguments? */);
        break;

    case 2:
        printListing(listingNumber, std::cin);  // 1st argument could be some other key into your collection of listings.
                                                // 2nd argument makes it more flexible than always writing to std::cin.
        break;

    case 3:
        deleteListing(listingNumber);    // argument could be some other key into your collection of listings
        break;

    case 4:
        saveListingBriefs(fileName);
        break;

    default:
        reportInputValueError();  // report that the input choice was invalid
        break;
}



Do your assignment is stages. Make sure you can enter multiple listings (#1) and then verify that they are all there with a debugger or do a quick std::cout dump of the contents of your listings collection. Then print out a particular listing (#2). Then do #4 and save the listing briefs. Then do #3 and try to delete a listing.

When you get stuck, try for 15 minutes to figure it out for yourself, and if you are unable, come back with questions. Tell us what you tried and why it didn't work. We can then get you past the tricky spots.

Edit: Had argument types in the switch statement, which is not a function prototype.
Last edited on
@ OP, contrary to popular belief, posting same post on multiple places does not provide quicker assistance. it looks like you are still working on the same project.
http://www.cplusplus.com/forum/beginner/215824/

Please, just continue on this thread with the real state project. Thanks.
Can anyone please help me out to run this program ...please I need help .. please be kind help me out here ;)

#include<iostream>
#include<fstream>
#include<cctype>
#include<iomanip>
#include<string>
using namespace std;


class property
{
int name, choice,select, type,account, PropertyNumber,acno,num, YearBuilt, ZipCode, Bedrooms,Type, Stories, MaxOccupancy,style,Marketvalue;
char Condition,cont;
string Style, StreetAddress, City, State;
double RentPerSquareFoot, Bathrooms;
public:
void create_property(); //function to get data from user
void show_property() const; //function to show data on screen
void modify(); //function to add new data
void dep(int); //function to accept amount and add to balance amount
void draw(int); //function to accept amount and subtract from balance amount
void report() const; //function to show data in tabular format
int retacno() const; //function to return account number
//int retdeposit() const; //function to return balance amount
//char rettype() const; //function to return type of account
}; //class ends here

void property::create_property()
{
cout<< "Select 1 for Residential or 2 for Commercial\n";
cin>> select;
if (select == 1);
cout<< "What is the style?\n?";
cin>> style;

cout<< "What is the Property Number?\n";
cin>> PropertyNumber;

cout<< "What is the Street Address?\n";
cin.clear();
fflush(stdin);
getline(cin, StreetAddress);

cout<< "What City is it in?\n";
cin.clear();
fflush(stdin);
getline(cin, City);

cout<< "What state is it in?\n";
cin.clear();
fflush(stdin);
getline(cin, State);

cout<< "What is the zip code of the property\n?";
cin>>ZipCode;

cout<< "How many Bedrooms does the property have?\n";
cin>> Bedrooms;

cout<< "How many bathrooms does the property have?\n?";
cin>>Bathrooms;

cout<< "How many stories is the property?\n?";
cin>> Stories;

cout<< "What condition is the property in?\n" ;
cin>> Condition;

cout<< "What year was the property built?\n";
cin>>YearBuilt;

cout<< "What is the Market Value of the property?\n";
cin>> Marketvalue;

cout<<"\n\n\nProperty Created..";
}

void property::show_property() const
{
cout<<"\nMLS No. : "<<endl;
cout<<"\nAccount Holder Name : ";
cout<<name;
cout<<"\nType of Account : "<<type;
//cout<<"\nBalance amount : "<<deposit;
}


void property::modify()
{
cout<<"\nMLS No. : "<<acno;
cout<<"\nModify Account Holder Name : ";
cin.ignore();
//cin.getline(name,50);
cout<<"\nModify Type of Account : ";
cin>>type;
type=toupper(type);
cout<<"\nModify Balance amount : ";
//cin>>deposit;
}


void property::Printlist()
{
//
}

void property::draw(int x)
{

}

void property::report() const
{
cout<<acno<<setw(10)<<" "<<name<<setw(10)<<" "<<type<<setw(6)<<endl;
}

int property::retacno() const
{
return acno;
}

//int property::retdeposit() const
//{
// return deposit;
//}

//char property::rettype() const
//{
// return type;
//}


void write_property(); //function to write record in binary file
void display_sp(int); //function to display account details given by user
void modify_property(int); //function to modify record of file
void delete_property(int); //function to delete record of file
void display_all(); //function to display all account details
void deposit_withdraw(int, int); // function to desposit/withdraw amount for given account
void intro(); //introductory screen function



int main()
{
char ch;
int num;
intro();
do
{
system("cls");
cout<<"\n\n\n\tMAIN MENU";
// cout<<"\n\n\t01. NEW ACCOUNT";
// cout<<"\n\n\t02. DEPOSIT AMOUNT";
// cout<<"\n\n\t03. WITHDRAW AMOUNT";
// cout<<"\n\n\t04. BALANCE ENQUIRY";
// cout<<"\n\n\t05. ALL ACCOUNT HOLDER LIST";
// cout<<"\n\n\t06. CLOSE AN ACCOUNT";
// cout<<"\n\n\t07. MODIFY AN ACCOUNT";
cout <<"- Real Estate Program -\n\n"

<<" 1.Enter new listing\n"

<<" 2.Print listing\n"

<<" 3.Delete listing\n"

<<" 4.Save listing briefs to file \n\n"

<<"Enter Selection: ";
cout<<"\n\n\t5. EXIT";
cout<<"\n\n\tSelect Your Option (1-5) ";
cin>>ch;
system("cls");
switch(ch)
{
case '1':
write_property();
break;
case '2':
cout<<"\n\n\tEnter The listing No. : "; cin>>num;
deposit_withdraw(num, 1);
break;
case '3':
cout<<"\n\n\tEnter The account No. : "; cin>>num;
deposit_withdraw(num, 2);
break;
case '4':
cout<<"\n\n\tEnter The account No. : "; cin>>num;
display_sp(num);
break;
case '5':
display_all();
break;
case '6':
cout<<"\n\n\tEnter The account No. : "; cin>>num;
//delete_mls(num);
break;
case '7':
cout<<"\n\n\tEnter The account No. : "; cin>>num;
//modify_account(num);
break;
case '8':
cout<<"\n\n\tThanks for using bank managemnt system";
break;
default :cout<<"\a";
}
cin.ignore();
cin.get();
}while(ch!='8');
return 0;
}

void write_propery()
{

}


void display_sp(int n)
{
{
cout<<"File could not be open !! Press any Key...";
return;
}
cout<<"\nBALANCE DETAILS\n";
//while(inFile.read(reinterpret_cast<char *> (&ac), sizeof(account)))
{
//if(ac.retacno()==n)
{
// ac.show_account();
// flag=true;
}
}
// inFile.close();
//if(flag==false)
cout<<"\n\nAccount number does not exist";
}




void modify_account(int n)
{
bool found=false;
//account ac;
fstream File;
File.open("account.dat",ios::binary|ios::in|ios::out);
if(!File)
{
cout<<"File could not be open !! Press any Key...";
return;
}
while(!File.eof() && found==false)
{
//File.read(reinterpret_cast<char *> (&ac), sizeof(account));
//if(ac.retacno()==n)
{
// ac.show_account();
cout<<"\n\nEnter The New Details of account"<<endl;
//ac.modify();
int pos=(-1)*static_cast<int>(sizeof(property));
File.seekp(pos,ios::cur);
// File.write(reinterpret_cast<char *> (&ac), sizeof(account));
cout<<"\n\n\t Record Updated";
found=true;
}
}
File.close();
if(found==false)
cout<<"\n\n Record Not Found ";
}


void delete_property(int n)
{
//account ac;
ifstream inFile;
ofstream outFile;
inFile.open("account.dat",ios::binary);
if(!inFile)
{
cout<<"File could not be open !! Press any Key...";
return;
}
outFile.open("Temp.dat",ios::binary);
inFile.seekg(0,ios::beg);
// while(inFile.read(reinterpret_cast<char *> (&ac), sizeof(account)))
{
//if(ac.retacno()!=n)
{
// outFile.write(reinterpret_cast<char *> (&ac), sizeof(account));
}
}
inFile.close();
outFile.close();
remove("account.dat");
rename("Temp.dat","account.dat");
cout<<"\n\n\tRecord Deleted ..";
}

void display_all()
{
//account ac;
ifstream inFile;
inFile.open("account.dat",ios::binary);
if(!inFile)
{
cout<<"File could not be open !! Press any Key...";
return;
}
cout<<"\n\n\t\tACCOUNT HOLDER LIST\n\n";
cout<<"====================================================\n";
cout<<"A/c no. NAME Type Balance\n";
cout<<"====================================================\n";
//while(inFile.read(reinterpret_cast<char *> (&ac), sizeof(account)))
{
//ac.report();
}
inFile.close();
}



void deposit_withdraw(int n, int option)
{
int amt;
bool found=false;
//account ac;
fstream File;
File.open("account.dat", ios::binary|ios::in|ios::out);
if(!File)
{
cout<<"File could not be open !! Press any Key...";
return;
}
while(!File.eof() && found==false)
{
// File.read(reinterpret_cast<char *> (&ac), sizeof(account));
//if(ac.retacno()==n)
{
//ac.show_account();
if(option==1)
{
cout<<"\n\n\tTO DEPOSITE AMOUNT ";
cout<<"\n\nEnter The amount to be deposited";
cin>>amt;
//ac.dep(amt);
}
if(option==2)
{
cout<<"\n\n\tTO WITHDRAW AMOUNT ";
cout<<"\n\nEnter The amount to be withdraw";
cin>>amt;
//int bal=ac.retdeposit()-amt;
//if((bal<500 && ac.rettype()=='S') || (bal<1000 && ac.rettype()=='C'))
cout<<"Insufficience balance";
//else
//ac.draw(amt);
}
//int pos=(-1)*static_cast<int>(sizeof(ac));
//File.seekp(pos,ios::cur);
// File.write(reinterpret_cast<char *> (&ac), sizeof(account));
cout<<"\n\n\t Record Updated";
found=true;
}
}
File.close();
if(found==false)
cout<<"\n\n Record Not Found ";
}
void intro()
{
cout<<"\n\n\n\t Welcome";
cout<<"\n\n\n\t To";
cout<<"\n\n\n\tReal Estate";
cout<<"\n\n\tMANAGEMENT";
cout<<"\n\n\t SYSTEM";


cin.get();

return;
}
If you could answer what @Thomas1965 asked, then it would be easier to help you.
#include<iostream>
#include<string>
using namespace std;
int main()
{
int choice,select, PropertyNumber, YearBuilt, ZipCode, Bedrooms,Type, Stories, MaxOccupancy,style,value;
double RentPerSquareFoot, Bathrooms;
string Style, StreetAddress, City, State;
char Condition,cont;
//Main menu
do
{

cout <<"- Real Estate Program -\n\n"
<<" 1.Enter new listing\n"
<<" 2.Print listing\n"
<<" 3.Delete listing\n"
<<" 4.Save listing briefs to file \n\n"
<<"Enter Selection: ";
cin>> choice;
switch(choice)



case 1:
{cout<< "What kind of property Residential or Comercial ?\n?";
cin>> style;
cout<< "What is the Property Number?\n";
cin>> PropertyNumber;
cout<< "What is the Street Address?"<<endl;
cin.clear();
fflush(stdin);
getline(cin, StreetAddress);
cout<< "What City is it in?\n";
cin.clear();
fflush(stdin);
getline(cin, City);
cout<< "What state is it in?\n";
cin.clear();
fflush(stdin);
getline(cin, State);
cout<< "What is the zip code of the property\n?";
cin>>ZipCode;
cout<< "How many Bedrooms does the property have?\n";
cin>> Bedrooms;
cout<< "How many bathrooms does the property have?\n?";
cin>>Bathrooms;
cout<< "How many stories is the property?\n?";
cin>> Stories;
cout<< "What year was the property built?\n"<<endl;
cin>>YearBuilt;
cout<< "What is the Market Value of the property?\n";
cin>> value;
cout<<"Thank You.\n";
Type=1;
break;
}

case 2:{
Print listing(); // 1st argument could be some other key into your collection of listings.
// 2nd argument makes it more flexible than always writing to std::cin.
break;}
case 3:{


deleteListing(listingNumber); // argument could be some other key into your collection of listings
break;}

case 4:{

saveListingBriefs(fileName);
break;
}
default:{

reportInputValueError(); // report that the input choice was invalid
break;
}

return 0;}


Yes I tried but it does not compile I am beginner .. please help me out . I don't know what should I do here
You start a do while loop, but the code is missing the while part at the end.

Check the syntax of the switch statement. There's a single set of {} around all the cases, not around each set of instructions in a case.

1
2
3
4
5
6
7
8
9
10
switch {

case 1:
       do stuff
       break;
case 2:
       do stuff
       break;
etc.
}


In the later cases, the code is calling functions that aren't defined yet. You could comment those out until they are defined so that won't be a cause for the code not to compile.


I'd consider making the property type a selection of a number from a menu or just asking the user to input a single 'R' or 'C' instead of making them type a long word.
1
2
cout<< "What kind of property Residential or Commercial ?\n?";
 cin>> style;
Last edited on
You have numerous compile errors.

If you don't understand a specific compile error, post the complete text of that compile error.

Line 22: You missing a { to start enclosing the cases of your switch statement.

Line 60: Print listing must be a single symbol. Did you intend Print_listing() ?
You have no Print_listing() function defined.

Line 79: You're missing a } to terminate your switch statement.
As previously pointed out, you don't need {} around each case. Doing so is harmless though.

Line 66: listingNumber is undefined.
deleteListing() is undefined.

Line 71: fileName is undefined.
saveListingBriefs() is undefined.

Line 76: reportInputValueError() is undefined.

PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#include <string>
#include <iostream>

using namespace std;

int main()
{

    int choice,select, PropertyNumber, YearBuilt, ZipCode, Bedrooms,Type, Stories,style,value;
    double RentPerSquareFoot, Bathrooms;

    string Style, StreetAddress, City, State;

    char  Condition,cont;

   

              {

                             system("cls");
                            

                             cout <<"- Real Estate Program -\n\n"

                                  <<" 1.Enter new listing\n"

                                  <<" 2.Print listing\n"

                                  <<" 3.Delete listing\n"

                                  <<" 4.Save listing briefs to file \n\n"

                                  <<"Enter Selection: ";

                                 

                                  cin>> choice;

                                  switch(choice)

{
case 1 : {
cout<<"What kind of property is it R or C ? "<<endl;
cin>>style;	
cout<< "What is the Street Address?"<<endl;
cin.clear();
fflush(stdin);
getline(cin, StreetAddress);
cout<< "What City is it in?\n";
cin.clear();
fflush(stdin);
getline(cin, City);

cout<< "What state is it in?\n";
cin.clear();
fflush(stdin);
getline(cin, State);
                              
cout<< "What is the zip code of the property\n?";
cin>>ZipCode;

cout<< "How many Bedrooms does the property have?\n";
cin>> Bedrooms;
cout<< "How many bathrooms does the property have?\n?";
cin>>Bathrooms;

cout<< "How many stories is the property?\n?";
cin>> Stories;

cout<< "What year was the property built?\n"<<endl;
cin>>YearBuilt;

cout<< "What is the Market Value of the property?\n";
cin>> value;
cout<<"Thank You.\n";

{ cout<<"Year built: "<<YearBuilt << " Zipcode: "<<ZipCode<<" "<<"Bedroom: "<< Bedrooms<< " Stories 	"<<Stories <<endl;}


                             Type=1;
                             break;

                             

                }
case 2:
{ cout<< PropertyNumber  <<YearBuilt << ZipCode << Bedrooms<< Type <<Stories <<endl;}


    case 3:
        //deleteListing();    // argument could be some other key into your collection of listings
        break;

    case 4:
        //saveListingBriefs(fileName);
        break;

    default:
        //reportInputValueError();  // report that the input choice was invalid
        break;
        

                

              }

             

}             while(cont == 'y' || cont == 'Y');

 do

              {

                            system("cls");

                            

                             cout <<"Enter (C) to continue or (Q) to quit. ";

                             cin >> cont;

              }

              while(cont == 'y' || cont == 'Y');

              system("pause");

              return 0;

{


}

}






This is what I did so far and trying to do print listing and delete listing
One problem you're going to run into as you try to implement your functions is that all your attributes of a property are individual variables. For example, if you were to make print_listing a separate function, you would need to pass every one of the attributes as an argument to the function call.

The way around this is to create a struct for a property that contains all the attributes for the property. That way, you only need to pass the struct to functions such as print_listing().

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
struct Property
{   int PropertyNumber;
    int YearBuilt;
    int ZipCode;
    int Bedrooms;
    int Type;
    int Stories;
    int style;
    int value;
    double RentPerSquareFoot;
    double Bathrooms;
    string Style;
    string StreetAddress;
    string City;
    string State;
};



Last edited on
Topic archived. No new replies allowed.