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

PA 6-3 (25 points) Modify and extend the real estate program in Module 6 Sample

ID: 3746346 • Letter: P

Question

PA 6-3 (25 points) Modify and extend the real estate program in Module 6 Sample Programs.docx to use a switch statement instead of if-else. The switch statement should include the shortcut technique so that lower case r, m, and c, do not give "Improper Property Code" message. Then determine and calculate the commission percentage on a real estate sale depending on the property. Use output manipulators to provide the correct number of decimal places and setw to align decimal points in the outputs. Use these value to calculate the commission for various property types. residential_rate-0.060; multidwelling rate 0.050; commercial rate 0.045; DACodeBlocks-EPlCodeBlocks-EPMMarsh2050Abin Enter the property's selling price: 329995 Enter the property code according to the following Single Family Residential, enter R Multiple Unit Residential, enter M Commercial, enter c Please make your selection: c For this Commercial property The value of the property is 329995.00 and The commission is 14849.77

Explanation / Answer

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

char o;

float num1;

float num2;

  

cout << "Enter the property's selling price': ";

cin >> num1;

  

cout << "Enter the property code according to the following :: "<<" ";

cout<< "Single family residential, enter R"<<" ";

cout<< "Multiple Unit residential, enter M"<<" ";

cout<< "Commercial, enter C"<<" ";

cin >> o;

  

switch (o)

{

case 'R':

num2 = num1*0.060;

std::cout << std::fixed;

std::cout << std::setprecision(2);

std::cout << " For this residential property the value of property is " << num1 << " and the commission is " <<setw(4)<< num2<<endl;

break;

case 'M':

num2 = num1*0.050;

std::cout << std::fixed;

std::cout << std::setprecision(2);

  

std::cout << " For this Multiple unit residential property the value of property is " << num1 << " and the commission is " << setw(4)<<num2<<endl;

break;

case 'C':

num2 = num1*0.045;

std::cout << std::fixed;

std::cout << std::setprecision(2);

std::cout << " For this commercial property the value of property is " << num1 << " and the commission is " <<setw(4)<< num2<<endl;

break;

default:  

cout << "Error! choice is not correct, Valid choices are R or M or C";

break;

}

  

return 0;

}