A customer in a store is purchasing five items. Write a program that asks for the price of each item, and then displays the subtotal of the sale, the amount of sales tax, and the total. Assume the sales tax is 7 percent. Display all results, properly labeled, as numbers with two digits after the decimal point.

Respuesta :

Answer:

Program approach:-

  • Using the header file.
  • Using the standard namespace I/O.
  • Define the main function.
  • Display the enter price of 5 terms.

Explanation:

Program:-

//header file

#include<iostream>

#include<iomanip>

//using namespace

using namespace std;

//main function

int main(){

       const double SALES_TAX=0.07;

       double subTotal=0,total=0,taxAmount = 0,x;

       

       cout<<"Enter price of 5 items"<<endl;

       for(int j=0;j<5;j++){

               cin>>x;

               subTotal += x;

       }

       taxAmount = subTotal * SALES_TAX;

       total = taxAmount + subTotal;

       cout<<fixed<<setprecision(2)<<endl;

       cout<<"Sub total: "<<subTotal<<endl;

       cout<<"Sales Tax: "<<taxAmount<<endl;

       cout<<"Total: "<<total<<endl;

       

       

}