Question

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 customers membership status, which can be either Standard or Premium. The appropriate shipping charges are shown in Figure 9-42. The program should use two program-defined 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 Advanced23 Project, and save it in the Cpp81Chap09 folder. Enter your C++ instructions into a source file named Advanced23.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 23. Total due before Membership type shipping (S) Shipping (S) Standard 12.99 4.99 4.99 0-100 Over 100 Premium 0-49.99 Over 49.99 0 Figure 9-42
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find below the required code:

//Advanced23.cpp

#include<iostream>

#include<iomanip>

using namespace std;

//method prototype that accept amount as double

//and return double value

double premiumMemberShippingCharge(double);

double standardMemberShippingCharge(double);

/*main function for executin the program*/

int main(void)

{

//amount due varibale

double amountDue;

//asking user to enter total amount due

cout<<"Enter the total amount due before shipping : ";

cin>>amountDue;

//using iomanip library displaying the two decimal places

cout<<fixed;

cout<<setprecision(2);

//calculating charges for both standard and premium by calling the function

double shippingChargeForPremium = premiumMemberShippingCharge(amountDue);

double shippingChargeForStandard = standardMemberShippingCharge(amountDue);

//displaying the charges for shipping

cout<<"\nFor standard user shipping charge for "<<amountDue<<" : "<<shippingChargeForStandard<<endl;

cout<<"For premium user shipping charge for "<<amountDue<<" : "<<shippingChargeForPremium<<endl<<endl;

//displaying total charges

cout<<"Total amount due after shipping for Standard user : "<<amountDue+shippingChargeForStandard<<endl;

cout<<"Total amount due after shipping for Premium user : "<<amountDue+shippingChargeForPremium<<endl;

return 0;

}

//method for calculating shipping charges for premium user

//data given for charges

double premiumMemberShippingCharge(double amount){

if(amount<0)//if negative amount then return 0

return 0;

else if(amount<=49.99)

return 4.99;

return 0;

}

//method for calculating shipping charges for standard user

double standardMemberShippingCharge(double amount){

if(amount<0)//if negative amount then return 0

return 0;

else if(amount<=100)

return 12.99;

return 4.99;

}

//OUTPUT

please do let me knwo if u have any concern...

Add a comment
Know the answer?
Add Answer to:
An online retailer wants a program that displays the total amount a customer owes, including shipping....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ The manager of Keystone Tile wants an application that displays the area of a rectangular...

    C++ The manager of Keystone Tile wants an application that displays the area of a rectangular floor, given its measurements in feet. It should also display the total cost of tiling the floor, given the price per square foot of tile. 1-Create a new project named Intermediate13 Project, and save it in the Cpp8\Chap04 folder. Enter your C++ instructions into a source file named Intermediate13.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Test the program...

  • Can someone help me with a c++ program Create a program that displays a measurement in...

    Can someone help me with a c++ program Create a program that displays a measurement in either inches or centimeters. If necessary, create a new project named Introductory 18 Project, and save it in the Cpp8\Chap09 folder. The program should allow the user the choice of converting a measurement from inches to centimeters or vice versa. Use two program-defined functions: one for each different conversion type. Enter your C++ instructions into a source file named Introductory 18.cpp Also enter appropriate...

  • Write a C++ program that will calculate the total amount of money for book sales at...

    Write a C++ program that will calculate the total amount of money for book sales at an online store. For each sale, your program should ask the number of books sold and then the price for each book and the shipping method (‘S’ for standard shipping and ‘E’ for expedited shipping). The program will produce a bill showing the subtotal, the sales tax, the discount, the shipping charge, and the final total for the sale. The program will continue processing...

  • Mountain Coffee wants a program that allows a clerk to enter the number of pounds of...

    Mountain Coffee wants a program that allows a clerk to enter the number of pounds of coffee ordered, the price per pound, and whether the customer should be charged a 3.5% sales tax. The program should calculate and display the total amount the customer owes. Use an int variable for the number of pounds, a double variable for the price per pound, and a char variable for the sales tax information. a. Create an IPO chart for the problem, and...

  • chapter 7. Create a program that allows the user to enter the ages (in years) of...

    chapter 7. Create a program that allows the user to enter the ages (in years) of five people. The program should display the average age. Use the for the statement. Display the average age with one decimal place. If necessary, create a new project named TryThis15 Project, and save it in the Cpp8\Chap07 folder. Enter the C++ instructions into a source file named TryThis15.cpp. Also, enter appropriate comments and any additional instructions required by the compiler. Test the program using...

  • 25. In this exercise, you create a program for the sales manager at Computer Haven, a...

    25. In this exercise, you create a program for the sales manager at Computer Haven, a small business that offers motivational seminars to local companies. Figure 7-53 shows the charge for attending a seminar. Notice that the charge per person depends on the number of people the company registers. For example, the cost for four registrants is $400; the cost for two registrants is $300. The program should allow the sales manager to enter the number of registrants for as...

  • What am I doing wrong here...…. Question is this : In this exercise, you will create...

    What am I doing wrong here...…. Question is this : In this exercise, you will create a program that displays a table consisting of four rows and three columns. The first column should contain the numbers 10 through 13. The second and third columns should contain the results of squaring and cubing, respec- tively, the numbers 10 through 13. The table will look similar to the one shown in Figure 9-38. If necessary, create a new project named Introductoryl6 Project,...

  •    The program should calculate and display the amount of federal withholding tax (FWT)...

       The program should calculate and display the amount of federal withholding tax (FWT) to deduct from the weekly gross pay. a.   The amount of FWT is based on the employee’s weekly taxable wages and filing status, which is either single (including head of household) or married. The program will need to calculate the weekly taxable wages by first multiplying the number of withholding allowances by $76.90 (the value of a withholding allowance in 2015) and then subtracting the result from...

  • // This program displays a menu and asks the user to make a 2 // selection....

    // This program displays a menu and asks the user to make a 2 // selection. An if/else if statement determines which item 3 // the user has chosen. 4 #include <iostream> 5 #include <iomanip> 6 using namespace std; 7 8 int main() 9 { 10 int choice; // To hold a menu choice 11 int months; // To hold the number of months 12 double charges; // To hold the monthly charges 13 14 // Constants for membership rates...

  • 201: Lab A 1. Download Eclipse onto your computer 2. Please follow this link if you are having trouble in installing Ecl...

    201: Lab A 1. Download Eclipse onto your computer 2. Please follow this link if you are having trouble in installing Eclipse. https://www.youtube.com/watch?v=TXbuATMlVNY&index=19&list=PL_v5Vo_UXw aHWOr2I9dq7DxI6Iw3eQzOd 3. Sample code #include <iostream> using namespace std; int main () { cout << "Hello world\n"; return 0; } Problem 2-1: Write a program that ask the user for the flowing: How many shares to be bought: The price per share: Percent commission for the broker for each transaction: Average annual return as of percentage: The...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT