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

A realtor friend of mine could use a program that would allow her to keep track

ID: 3566233 • Letter: A

Question

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; 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).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. 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 ID and reduce its price by reduction amount so you need to subtract the reduction from current price of the property. 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).Displays all the properties in the program along with their price tags and number of bedrooms. This report, at the end, should also display average home price. Make sure that your program is presentable, user friendly .Make sure that the information is saved to/from a data file.

Explanation / Answer

#include<iostream>

using namespace std;

struct property{
int id;
int price;
int no_of_bedrooms;
};

struct property arr[100];
int count = 0;

void newProperty(){
while(1){
cout << "Enter property number : ";
cin >> arr[count].id;

if(arr[count].id >0 && arr[count].id <120000){
break;
}else{
cout << "Invalid ID Enter again ";
}
}
while(1){
cout << "Enter property price : ";
cin >> arr[count].price;

if(arr[count].price >50000 && arr[count].price < 10000000){
break;
}else{
cout << "Invalid Price Enter again ";
}
}
while(1){
cout << "Enter no of bedrooms : ";
cin >> arr[count].no_of_bedrooms;

if(arr[count].no_of_bedrooms >0){
break;
}else{
cout << "Invalid no of bedrooms Enter again ";
}
}
count++;
}

void priceReduction(){
int id, reduction;
cout << "Enter the id of the property : ";
cin >> id;
cout << "Enter the reduction price : ";
cin >> reduction;

for(int i=0; i<count; i++){
if(arr[i].id == id){
arr[i].price -= reduction;
}
}
}

void search(){
int maxPrice,minBed;
cout << "Enter Maximum price to pay : ";
cin >> maxPrice;
cout << "Enter Minimum bedroom required : ";
cin >> minBed;

for(int i=0; i<count; i++){
if(arr[i].price <= maxPrice && arr[i].no_of_bedrooms >= minBed){
cout << arr[i].id << " " << arr[i].price << " " << arr[i].no_of_bedrooms << endl;
}
}
}

void report(){
int sum = 0;
for(int i=0; i<count; i++){
cout << arr[i].id << " " << arr[i].price << " " << arr[i].no_of_bedrooms << endl;
sum += arr[i].price;
}
float avg = (float)sum/count;
cout << "Average home price : " << avg << endl;
}

int main(){
int choice;
do{
cout << "***************************************** ";
cout << "***************** MENU **************** ";
cout << "****************************************** ";
cout << "1. New Property ";
cout << "2. Price Reduction ";
cout << "3. Search Property ";
cout << "4. Report ";
cout << "5. Exit ";
cout << "Enter your choice : ";
cin >> choice;

switch(choice){
case 1:
newProperty();
break;
case 2:
priceReduction();
break;
case 3:
search();
break;
case 4:
report();
break;
case 5:
cout << "Exiting From the program ....... ";
return 0;
default :
cout << "Invalid choice Enter again ";
}
}while(1);
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote