Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Step 3) Create two new files: - ShoppingCart.h - Class declaration - ShoppingCart.cpp - Class definition uild the ShoppingCart class with the following specifications.

C++image text in transcribed

Step 3) Create two new files: - ShoppingCart.h - Class declaration - ShoppingCart.cpp - Class definition uild the ShoppingCart class with the following specifications. Note: Some can be function stubs (empty unctions) initially, to be completed in later steps. - Default constructor - Parameterized constructor which takes the customer name and date as parameters - Private data members - string_customerName - Initialized in default constructor to "none" - string_currentDate - Initialized in default constructor to "January 1, 2016" - vector _cartItems - Public member functions - customerName () accessor - date () accessor - addItem() - Adds an item to cart items vector. Has a parameter of type ItemToPurchase. Does not return anything. - removeItem() - Removes item from cart items vector. Has a parameter of type string (an item's name). Does not return anything. - If item name cannot be found, output this message: Item not found in cart. Nothing removed. - modifyItem() - Modifies an item's description, price, and/or quantity. Has a parameter of type ItemToPurchase. Does not return anything. - If item can be found (by name) in cart, check if parameter variable has default values for description, price, and/or quantity. For each of the non-default values in parameter, set the item in the cart to the non-default value. For example, if the parameter has non-default values for quantity and price but a default value for the description, then just set the quantity and price in the cart item to the parameter's values for quantity and price and leave the cart item's description alone. - If item cannot be found (by name) in cart, output this message: Item not found in cart. Nothing modified. - numItemsInCart() - Returns quantity of all items in cart. Has no parameters. - cost0fCart() - Determines and returns the total cost of items in cart. Has no parameters. - printTotal() - Outputs total of objects in cart. - If cart is empty, output this message: SHOPPING CART IS EMPTY - printDescriptions() - Outputs each item's description

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

Do Problem 11.119 with R-22 as the working fluid.

Answered: 1 week ago