Program to calculate tax:
float tax (float) ;
int main()
{
float purchase, tax_amt, total;
cout << "\nAmount of purchase: ";
cin >> purchase;
tax_amt = tax(purchase);
total = purchase + tax_amt;
cout.precision(2);
cout << "\nPurchase is: " << purchase;
cout << "\nTax: " << tax_amt;
cout << "\nTotal: " << total;
return 0;
}
float tax (float amount)
{
float rate = 0.065;
return(amount * rate);
}