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

#include<iostream> #include <iomanip> #include <string> using namespace std; int

ID: 3619383 • Letter: #

Question

#include<iostream>
#include <iomanip>
#include <string>
using namespace std;

int negative(int t)
{
   
char p;
cout<< "do you want to terminate the program?";
cin>>p;
if (p="yes"||"y")
return 0;
}

double calculate (doublesaleamount)
{
double commission;
if
( saleamount >= 3000.00 )
    return commission = saleamount * 0.05;
else if
( saleamount >= 2000.00)
   return commission = saleamount * 0.045;
else if
( saleamount >= 1000.00)
   return commission = saleamount * 0.040;
else
(saleamount >= 0.00);
   return commission = saleamount * 0.035;
  

}

int main()
{
double x;
int t;

do

{

cout <<"Please Enter Total Sale Amount: ";
cin >> x;
x=calculate(x);
cout<< "The commission " <<x <<' ';

}while (x>0);

}

Explanation / Answer

Reallly sorry Friend for reposting it.There is a problem inthe above post that is why i am reposting it again.The statement in the abovepost if (p="yes"||p="y") is wrong see the programe below itsworking fine.
#include <iostream> #include <iomanip> #include <string> using namespace std; int negative(int t) { string p; cout<< "do you want to terminatethe program? (Type yes or y)"; cin>>p; if ((p=="yes")||(p=="y")) return 0; else return 1; } double calculate (double saleamount) { double commission; if( saleamount >= 3000.00 ) return commission = saleamount * 0.05; else if( saleamount >= 2000.00) return commission = saleamount * 0.045; else if( saleamount >= 1000.00) return commission = saleamount * 0.040; else(saleamount >= 0.00); return commission = saleamount * 0.035; } int main() { double x; int t; do { cout << "Please Enter Total Sale Amount: "; cin >> x; x=calculate(x); cout<< "The commission " <<x <<' '; }while (negative(x)!=0); return 0; }
Hope this will help you. PLZ Rate...