is below this banner.

Can't find a solution anywhere?

NEED A FAST ANSWER TO ANY QUESTION OR ASSIGNMENT?

You will get a detailed answer to your question or assignment in the shortest time possible.

## Here's the Solution to this Question

``````
#include <iostream>
#include<string>
#include <fstream>
using namespace std;

//structer declaration
struct property{
int property_code;
string description;////either house or site
string type;//residential or commercial , if house, family ,mansion or apartment
int price;
};
struct broker{
string Brcode, Brname;
int maxsale;
property sales[20];
int number_sales;//should not be more than hundred

};
struct seller{
int regnumber;
string name;
property sales[20];
int number_sales;
int accumulative_m_sale;

};
int reg_number;
string name ;
property purchases[20];
int accumulative_m_purchases;
int number;//number of purchases
int accumulative_m_discounts;
};

//prototype
seller sellers[20];
broker brokers[20];
int num_brokers=0;//keeps a the number of brokers
int num_sellers=0;

//report function
void tabulate(){
fstream copy;
copy.open("brokers.txt", fstream::app);
if(copy.is_open()){
for(int i=0;i<num_brokers;i++){
copy<<"BROKER : ";
copy<<brokers[i].Brcode;
copy<<" | ";
for(int j=0;i<brokers[i].number_sales;j++){

copy<<brokers[i].sales[j].description;
copy<<" ";
copy<<brokers[i].sales[j].type;
copy<<" ";
copy<<brokers[i].sales[j].price;

copy<<" | ";

}
copy<<"\n ";
}
}
}

//acummulation function for seller
int accumulative_msales(seller name){

int sum=0;
for (int i=0;i<name.number_sales;i++){
sum=sum+name.sales[i].price;
}
return sum;
}

int sum=0;
for (int i=0;i<name.number;i++){
sum=sum+name.purchases[i].price;
}
return sum;
}

//discount function

int sum=0;
for (int i=0;i<name.number;i++){
sum=sum+name.purchases[i].price;
}
int discount=(sum*(1.2/100));
return discount;
}

//store each in their individual respective lists
if (num_brokers<20){
brokers[num_brokers].Brcode=name1.Brcode;
brokers[num_brokers].Brname=name1.Brname;
brokers[num_brokers].maxsale=name1.maxsale;
brokers[num_brokers].number_sales=name1.number_sales;
for(int i=0;i<brokers[num_brokers].number_sales;i++){
brokers[num_brokers].sales[i]=name1.sales[i];
}

num_brokers++;
}
else{
cout<<"list of brokers is full\n";  //must be less than 20
}
if (num_sellers<20){
sellers[num_sellers].accumulative_m_sale=name2.accumulative_m_sale;
sellers[num_sellers].name=name2.name;
sellers[num_sellers].number_sales=name2.number_sales;
sellers[num_sellers].regnumber=name2.regnumber;
for(int i=0;i<sellers[num_sellers].number_sales;i++){

sellers[num_sellers].sales[i]=name2.sales[i];
}

num_sellers++;
}
else{
cout<<"list of sellers is full\n";
}

}

}
else{
}

}

void transaction(){//this transaction may be a transaction for a house or site
property name;
num_brokers++;
if (brokers[num_brokers].number_sales<brokers[num_brokers].maxsale){
cout<<"ENTER THE PROPETY DESCRIPTION , HOUSE or SITE : \n";
cin>>name.description;
cout<<"ENTER THE PROPERTY TYPE e.g whether apartment or mansion or family if house or use for the site i.e commercial \n";
cin>>name.type;
cout<<"ENTER THE PRICE :] \n";
cin>>name.price;
cout<<"ENTER THE PROPERTY CODE :\n";
cin>>name.property_code;
brokers[num_brokers].number_sales++;
brokers[num_brokers].sales[num_sellers]=name;

}

}
int max_sale(){
int max=0;
for(int k=0;k<num_brokers;k++){
for(int i=0;i<brokers[k].number_sales;k++){
if(brokers[k].sales[i].price>=max){
max=brokers[k].sales[i].price;
}
}
}

return max;
}

//
void display_reg(){
int index;
int code ;
cout<<"ENTER THE SITE OR HOUSE code name FOR SEELER AND BUYER \n";
cin>>code ;//we will use the fact that  the index of the property sales in brokers matches that of sellers and buyers corresponding
for(int i=0;i<num_brokers;i++){
for(int j=0;j<brokers[i].number_sales;j++){
if (brokers[i].sales[j].property_code==code){
index=j;
}
}
}
}
//swap function
void swap(property name1, property name2){
string temporary ;
temporary =name1.description;
name1.description=name2.description;
name2.description=temporary;

}
void list_properties(){
string temp;
int t;
for(int i=0;i<num_brokers;i++){
for (int k=0;brokers[i].number_sales;k++){
for(int j=k+1;j<brokers[i].number_sales;j++){
if(brokers[i].sales[k].price<brokers[i].sales[j].price){
temp=brokers[i].sales[k].description;
brokers[i].sales[k].description=brokers[i].sales[j].description;
brokers[i].sales[j].description=temp;
t=brokers[i].sales[k].price;
brokers[i].sales[k].price=brokers[i].sales[j].price;
brokers[i].sales[j].price=t;
t=brokers[i].sales[k].property_code;
brokers[i].sales[k].property_code=brokers[i].sales[j].property_code;
brokers[i].sales[j].property_code=t;
temp=brokers[i].sales[k].type;
brokers[i].sales[k].type=brokers[i].sales[j].type;
brokers[i].sales[j].type=temp;
}
}
}
}
for(int i=0;i<num_brokers;i++){
for (int k=0;k<brokers[i].number_sales;k++){
cout<<"the sorted list in descending order is  :\n";
cout<<brokers[i].sales[k].property_code<<"code  ";
cout<<brokers[i].sales[k].type<<"type ";
cout<<brokers[i].sales[k].price<<"price \n";
}
}
}

//monthly report function to txt file
void monthly_report(){
fstream copy;
copy.open("report.txt", fstream::app);
if(copy.is_open()){
for(int i=0;i<num_brokers;i++){
copy<<"BROKER : ";
copy<<brokers[i].Brcode;
copy<<" | ";

copy<<"seller :";
copy<<sellers[i].name;
copy<<" | ";
copy<<"   |  ";
for(int j=0;i<brokers[i].number_sales;j++){

copy<<brokers[i].sales[j].description;
copy<<" ";
copy<<brokers[i].sales[j].type;
copy<<" ";
copy<<brokers[i].sales[j].price;

copy<<" | ";

}
copy<<"\n ";
}
}
}
property name1, name2;
broker name3;
seller name4;
int n, choice;

cout<<"*************************************************\n";
cout<<"*************************************************\n\n";

cout << "2. Insert Data of sites and houses \n";     //siteshouses
cout << "3. Search for highest maximum sale of broker \n";    //maximum
cout << "4. Search a certain house's registration of seller and buyer \n";    //registration
cout << "5. Swap description of two properties\n";       //swap
cout << "6. List all properties in descending order of price\n";   //descendingorder
cout << "7. Generate monthly reports of broker, sellers, buyers, sites and houses \n";     //report
cout << "8. Exit \n";     //exit

cout << "\n\nWhat would you like to do from the above menu: ";

cin >> choice;

switch (choice){

case 1:
break;

case 2:
transaction();
break;

case 3:
max_sale();
break;

case 4:
display_reg();
break;

case 5:
swap(name1, name2);
break;

case 6:
list_properties();
break;

case 7:
monthly_report();
break;

}
while(choice !=8);
cout<<"Exiting...Blessed day!";

}

int main()
{
system("color 1F");

cout<<"\tLesotho House of Brokers (LHB)\n";
cout<<"\ttrack of all brokers nationwide\n\n";

drive();
return 0;
}``````