Viewing code of RPBROKER
// ------ ../cgi-bin/cout/RPBROKER.CPP --------------
//--- Programmed By Rajesh -----

/*
Calculating Real Estate Commissions (8-2)
A real estate broker sets fees for selling properties according to the property type. Those fees are:

Property Type Code Rate
Residential R 0.060
Multi-dwelling M 0.050
Commercial C 0.045

The broker wants you to write a program that prompts the user for the sale price of the property and the property type code. The program should then display the dollar amount of the broker’s commission (the sale price multiplied by the appropriate commission rate). If the user enters an invalid property code, the program should display an error message and stop. Allow the user to enter upper or lowercase letters.

A sample of the output is:
Enter the property’s selling price: 270000
Enter the code the property code according to the following:
Residential enter R
Multiple Dwelling enter M
Commercial enter C
Please make your selection: R

The commission is $16200.00


*/



#include<stdio.h>
#include<conio.h>
void main(){
float sp;
float commission;
int choice;
printf("\n\n Enter the property's Selling price: $");
scanf("%f",&sp);
/* because I had problems in switch cases , I found easy if I used integer values for switch cases
or I had to convert the ascii value of R, M, C into integer and then use the switch case.
Try as I have done in getche() in case of program that checks digits and characters
*/

printf("\n Enter the code the property code according to the following:"
"\n\t Residential enter 1" // not enter 1
"\n\t Multiple Dwelling enter 2" // not 2
"\n\t Commercial enter 3" // not c
"\n\t Please make your selection: ");
scanf("%d",&choice);
switch(choice){
case 1:
printf("choice is R");
commission = 0.060 *sp;
break;
case 2:
printf("choice is Multiple Dwelling");
commission = 0.050 *sp;
break;
case 3:
printf("\n Choice is Commercial");
commission = 0.045 *sp;
break;

default:
printf("\n Error:\n Please just select either 1=R,2=M or 3=C ");
break;

}
printf("The commission is %.2f",commission);
}