How can I get this program I wrote to calculate the sales ta
How can I get this program I wrote to calculate the sales tax if it is deemed the customer needs to pay sales tax? Whether I put in yes or no, it always give me the answer without applying sales tax.
#include <iostream>
 #include <iomanip>
 #include <cmath>
 using namespace std;
int main()
 {
    //declare vairables and constants
    int pounds = 0;
    double poundPrice = 0.0;
    char yesTax = \' \';
    const int doubleTax = 0.035;
    double poundsPrice = 0.0;
    double withTax = 0.0;
    double noTax = 0.0;
    double withTaxA = 0.0;
    double withTaxB = 0.0;
   cout << \"Pounds ordered : \";
    cin >> pounds;
    cout << \"Price per pound : \";
    cin >> poundPrice;
    cout << \"Does the customer need to be charged sales tax? (Y or N) : \";
    cin >> yesTax;
   if (yesTax == \'Y\')
    {
        withTaxA = (poundPrice * pounds);
        withTaxB = (withTaxA * doubleTax);
        withTax = (withTaxA + withTaxB);
        cout << fixed << setprecision(2);
        cout << \"Total: $\" << withTax << endl;
    }
    else if (yesTax != \'Y\')
    {
        noTax = poundPrice * pounds;
        cout << fixed << setprecision(2);
        cout << \"Total: $\" << noTax << endl;
    }
    //end if
   system(\"PAUSE\");
    return 0;
 } //end of main function
Solution
#include <iostream>
 #include <iomanip>
 #include <cmath>
 using namespace std;
 int main()
 {
 //declare vairables and constants
 double pounds = 0;
 double poundPrice = 0.0;
 char yesTax = \' \';
 // tax should be double
 const double doubleTax = 0.035;
 double poundsPrice = 0.0;
 double withTax = 0.0;
 double noTax = 0.0;
 double withTaxA = 0.0;
 double withTaxB = 0.0;
   
 cout << \"Pounds ordered : \";
 cin >> pounds;
 cout << \"Price per pound : \";
 cin >> poundPrice;
 cout << \"Does the customer need to be charged sales tax? (Y or N) : \";
 cin >> yesTax;
if (yesTax == \'Y\')
 {
 withTaxA = (poundPrice * pounds);
 withTaxB = (withTaxA * doubleTax);
 withTax = (withTaxA + withTaxB);
 cout << fixed << setprecision(2);
 cout << \"Total: $\" << withTax << endl;
 }
 else
 {
 noTax = poundPrice * pounds;
 cout << fixed << setprecision(2);
 cout << \"Total: $\" << noTax << endl;
 }
 //end if
 // system(\"PAUSE\");
 return 0;
 } //end of main function
 /*
 output:
Pounds ordered : 56
 Price per pound : 2
 Does the customer need to be charged sales tax? (Y or N) : Y
 Total: $115.92
 Pounds ordered : 56
 Price per pound : 2
 Does the customer need to be charged sales tax? (Y or N) : N
 Total: $112.00
*/


