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

Create an application that can be used to calculate the total amount due for pur

ID: 3918729 • Letter: C

Question

Create an application that can be used to calculate the total amount due for purchases. Allow any number of items to be entered. Determine the total due including sales tax and shipping. Sales tax of 7.75% is charged against the total purchases. Shipping charges can be determined based on the number of items purchased. Use the following chart to determine the shipping charge. Fewer than 3 items $3.50 3 to 6 items $5.00 7 to 10 items $7.00 11 to 15 items $9.00 more than 15 items $10.00

Display an itemized summary containing the total purchase charge, number of items purchased, sales tax amount, shipping charge, and grand total.

CAN YOU DO IT WITH METHODS

Explanation / Answer

#include<iostream>
using namespace std;

float tax(int x)
{
return(0.0775*x);
}

float shipping(int n)
{
if(n<3)
{
return(n*3.5);
}
if(n>=3 && n<=6)
{
return(n*5);
}
if(n>=7 && n<=10)
{
return(n*7);
}
if(n>=11 && n<=15)
{
return(n*9);
}
if(n>15)
{
return(n*10);
}
}

int main()
{
int n;float shipping_charge;float sales_tax;float grand_total;float total_purchase;
cout<<"Enter the number of items"<<endl;
cin>>n;
cout<<"enter the total purchase ammount"<<endl;
cin>>total_purchase;

sales_tax=tax(total_purchase);
shipping_charge=shipping(n);
grand_total=total_purchase+sales_tax+shipping_charge;

cout<<endl<<endl<<endl;
cout<<"Total purchase = "<<total_purchase<<endl;
cout<<"Number of purchased items = "<<n<<endl;
cout<<"Sales tax ammount = "<<sales_tax<<endl;
cout<<"Grand Total ammount = "<<grand_total<<endl;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote