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

x.Hmy one see if my validation for selling price and property type are working?

ID: 3615066 • Letter: X

Question

x.Hmy one see if my validation for selling price and property type are working?
because i am not sure what is wrong with my validation.


#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
#define RC 0.1           /*residential commission rate*/
#define CC 0.2           /*commercial commission rate*/
#define MC 0.15          /*multiunit dwelling commission rate*/
#define SIZE 50           /*size of arrays*/
double Thesmallest ( double comm[SIZE] , int numco);
double Thelargest ( double comm[SIZE] , int numco);
int main ()
{
    int             
              yesno,           /* loop controller, loops when = 1 or 0 */
              numco = 0,
              zero =0,
              numcor = 0,       /*number of residential*/
              numico = 0,       /*number of commercial*/
              numcoi = 0,       /*number of multiunit*/
              numcoa = 0;       /*total number of all commission*/
          

    char      prope;           /*type of property*/       
    double    sell,               /*selling price*/
              largest,           /*largest of commission*/
              smallest,         /*smallest of commission*/   
              comm[SIZE],        /*commission*/  
              totr=0,           /*total amount of residential commission*/
              totc=0,           /*total amount of commercial commission*/
              totm=0,           /*total amount of multiunit commission*/
              total=0;           /*total amount of all commission*/
          
    string id;          
   do
   {  
      
       cout << "Fernando Commission Computer";
       cout <<endl;
       cout << "Please enter 5 digit agent ID: ";
       cin >> id ;
       while (id.size()!= 5)
       {
           cout << "Invalid ID please enter 5 digit number" <<endl;
           cin >>id;
       }
       cout << "Select the category of property sold ";
       cout << endl;
       cout << "R||r= residential, C||c=commercial, M||m=multiunit ";
       cout << endl;
       cout << "Your choice ";
       cin >> prope;
       while ( prope !=('r','c','m' && 'R','C','M'));
              cout << "Invalid property";
              cout << "Please re-enter property";
              cin >> prope;
       switch (toupper(prope))
       {
           case 'R':
               cout << "Please enter selling price " <<endl;
               cin >> sell;
               while ( sell < zero);
                      cout << "Invalid price";
                      cout << "Please re-enter selling price";
                      cin >> sell;
               comm [numco] = sell*RC;
               totr += comm[numco];
               cout << "Total amount of Residential commissions for Agent "<< fixed << setprecision(2) << id << " is: " << comm[numco] << endl;
               numcor++;
                numco++;
               break;
           case 'C':
               cout <<"Please enter selling price " << endl;
               cin >> sell;
               while ( sell < zero);
                      cout << "Invalid price";
                      cout << "Please re-enter selling price";
                      cin >> sell;
&nbs

Explanation / Answer

x.