Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(Visual Studio, C++ We did not yet learn about functions and input/output from/t

ID: 3731376 • Letter: #

Question

(Visual Studio, C++

We did not yet learn about functions and input/output from/to a file on disk. So please ignore the following two requirements for this assignment:

1.Each feature must be in a separate function (­50).

2.Make sure that the information is saved to/from a data file. (30 points)

REALTOR ASSIST V1.0 (with File 1/O) A realtor friend of mine could use a program that would allow her to keep track of real estate property listings Here are the main features of the program; 1) New Property [30 points] The realtor uses this feature to add a new property listing to the program. For each property, the program should ask for the property number (a number between 1-20000), the asking price of the property (currency) and the number of bedrooms (a number). Your program should not accept a property whose price is less than $50,000 and greater than 10,000,000. Also each property must have at least 1 bedroom (no max limit). If the property does not conform to these rules, you may display an error message and cancel out of the feature (to the main screen). 2) Price Reduction [40 points] We often go into price reduction if the property is not sold for a certain period of time (a year or so). So, we need a feature where the realtor can enter a reduction price. The program should ask for the property ID and the amount of reduction. Find the home with the provided property ID and reduce its price by reduction amount- so you need to subtract the reduction from current price of the property 3) Search Property [50 points] During meetings with potential buyers, the realtor often feels the need to search the inventory based on the budget and the need of the buyer. We need this feature so that realtor can input the maximum price the buyer is willing to pay and the minimum number of bedrooms desired. The program should scan the inventory for all properties with price tag less than or equal to the amount buyer wants to pay and the number of bedrooms greater than or equal to the number of bedrooms needed by the buyer. The results should be displayed on screen (one property per line) 4) Report [30 points] bedrooms. This report, at the end, should also display average home price 5) Exit [5 points] Displays all the properties in the program along with their price tags and number of Exits the program Make sure that your program is presentable, user friendly (15 points) Make sure that the information is saved tolfrom a data file. (30 points)

Explanation / Answer

#include<iostream.h>

#include<process.h>

using namespace std;

int main()

{

int number[200],room[200]; // since data to be stored in arrays only, or else you can use structures also

float price[200];

int ch,i,j,top=0;

int search,bd,flag; //variables for searching property id, minumum # of bedrooms,flag to check

float red_price,max_price,total; // variables for reduction price, maximum price

  

do

{

i=top;

flag=0;

cout<<"1.Add new property ";

cout<<"2.Price reduction ";

cout<<"3.Search property ";

cout<<"4.Report ";

cout<<"5.Exit ";

cout<<"Enter your choice : ";

cin>>ch;

  

switch(ch)

{

case 1:

cout<<" Enter Property Number: ";   

cin>>number[i];

cout<<" Enter number of bedrooms: ";

cin>>room[i];

cout<<" Enter Price: ";

cin>>price[i];

if(!(number[i]>=1)&&(number[i]<=20000)) //check property id range

{cout<<" Property Number should be in between the range of 1 and 20,000 ";

break;

}

else if(!(price[i]>=50000)&&(price[i]<=10000000)) // check price range

{cout<<" Property price should be in between the range of $50,000 and $10,000,000 ";

break;

}

else if(room[i]<1) // check # of bedrooms

{cout<<" Number of bedrooms should be more than 0 ";

break;

}

else

{

top++;

break;

}

case 2:

cout<<" Enter Property Number for which price to be reduced: ";   

cin>>search;

cout<<" Enter how much price to be reduced: ";   

cin>>red_price;

for(j=0;j<top;j++)

{

if(number[j]==search)

{

price[j]=price[j]-red_price;

flag++;

break;

}

}

if(flag==0) // flag to check whether searching Property is found or not

cout<<"Property with given ID is not found"<<endl;

break;

case 3:cout<<" Enter maximum price to be searched for: ";   

cin>>max_price;

cout<<" Enter the minimum number of bedrooms required: ";   

cin>>bd;

cout<<"ID Price Bedrooms"<<endl;

for(j=0;j<top;j++)

{

if((price[j]<=max_price)&&room[j]>=bd)

cout<<number[j]<<" $"<<price[j]<<" "<<room[j]<<endl;

}

break;

case 4:cout<<"list of properties: ";

cout<<"ID Price Bedrooms"<<endl;

for(j=0;j<top;j++)

{

cout<<number[j]<<" $"<<price[j]<<" "<<room[j]<<endl;

total+=price[j];

}  

cout<<"Average home price is :"<<(total/top)<<endl;

total=0;

break;

case 5: exit(0);

}

cout<<" ";

}while(ch>=1&&ch<6);   

return 0;

}