an-introduction-to-programming-with-cpp-8th-edition.pdf-Adobe Acrobat Reader DC
ID: 3695569 • Letter: A
Question
an-introduction-to-programming-with-cpp-8th-edition.pdf-Adobe Acrobat Reader DC File Edit View Window Help Sign In Home ools an-introduction-to-... × Figure 10-28 Export PDF An online retailer wants a program that displays the total amount a customer owes, including shipping. The user will enter the total amount due before shipping. The amount to charge for shipping is based on the customer's membership status, which can be either Standard or Premium. The appropriate shipping charges are shown in Figure 10-29. The program should use two void functions: one to determine the shipping charge for a Standard member and the other to determine the shipping charge for a Premium member. If necessary, create a new project named Advanced22 Project, and save it in the Cpp8Chap10 folder. Enter your C++ instructions into a source file named Advanced22.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Display the total due in fixed-point notation with two decimal places. Test the program appropriately. 22. ADVANCED Adobe Export PDF Convert PDF Files to Word or Excel Online Select PDF File an-introduct...-edition·pdf × Convert to Microsoft Word(.docx) Document Language English (U.S.) Change Total due before shippin 0-100 Over 100 Membership type Standard Shippin 12.99 4.99 Convert 0-49.99 Over 49.99 Premium 4.99 Create PDF Figure 10-29 Edit PDF Comment Store and share files in the Document Cloud Learn More Ask me anything 9:05 PM 4/27/2016Explanation / Answer
#include<iostream>
#include <iomanip>
using namespace std;
void st_charges(double amt)
{
double total=amt;
if(amt<=100)total+=12.99;
else total+=4.99;
cout<<"The total amount due is $"<<setprecision(3)<<total<<endl;
return;
}
void pr_charges(double amt)
{
double total=amt;
if(amt<50)total+=4.99;
cout<<"The total amount due is $"<<setprecision(3)<<total<<endl;
return;
}
int main()
{
double amt;
char ch;
cout<<"Please enter total amount due before shipping:";
cin>>amt;
cout<<"What membership do you hold? (Type p for premium and s for standard)";
cin>>ch;
if(ch=='p')pr_charges(amt);
else if(ch=='s')st_charges(amt);
else cout<<"Invalid membership."<<endl;
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.