c++ Build the ShoppingCart class with the following specifications. Note: Some can be function stubs (empty functions) 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 < ItemToPurchase > _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. costOfCart() 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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

c++

Build the ShoppingCart class with the following specifications. Note: Some can be function stubs (empty functions) 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 < ItemToPurchase > _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.
    • costOfCart()
      • 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.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education