asked 191k views
0 votes
Output change returned for item costing $26.50, customer gives you $50 and federal tax is 20% (.20) and state tax is 5% (.05)

1 Answer

3 votes

Answer:

// Here is code in C++.

#include <bits/stdc++.h>

using namespace std;

int main()

{

// declare and initialize variables

float item_cost=26.50;

float federal_tax=0.2,state_tax=0.05;

float cust_pay=50;

// calculate change

float change=cust_pay-(item_cost*(1+federal_tax+state_tax));

cout<<"change returned to customer is:$"<<change<<endl;

return 0;

}

Step-by-step explanation:

Declare and initialize item cost with 26.5, federal tax with 0.2(i.e 20%) and state tax with 0.05(i.e 5%).After that initialize customer pay with 50. Then calculate total cost of item and subtract it from cust_pay.This will be the change amount that should be returned to customer.

Output:

change returned to customer is:$16.875

answered
User Garst
by
7.9k points

No related questions found