Question: 3 5 . 2 3 Final Project : Shopping Online ( Full ) This project is to build the functionality that would be found in

35.23 Final Project : Shopping Online (Full)
This project is to build the functionality that would be found in a typical online shopping cart. While yours will not be a true online cart, it will mimic the same features that are common. You will be required to use OOP concepts along with functions, vectors and of course core C++ control statements.
The program will be tested by many test. The classes will be tested by unit testing. This is where I will have code that will build objects and test the objects. This means that you need to give your classes the proper naming (pay attention to the capitalization), and have the correct parameters. You will get errors about undefined if something is mismatched. Remember that you can always satisfy these compilation requirements with at least a stub (empty function definition). A stub will of course fail an actual test, but at least the code will compile and execute. Other testing will be output based testing that you have seen most of the semester.
Be sure that you do a lot of testing in your IDE because you will be given limited opportunities to check your solution against the testbench. Your goal should be to satisfy many new tests for each submission to the testbench. This way you will have plenty submissions to get all tests to pass.
The following provides detailed requirements for the required functionality.
You will need an ItemToPurchase class using the following files:
ItemToPurchase.h - Class declaration
ItemToPurchase.cpp - Class definition
The following specifications should be followed:
Default constructor
Parameterized constructor to assign item name, item description, item price, and item quantity (default values of 0)
Public class functions (mutators & accessors)
SetName() & GetName()
SetPrice() & GetPrice()
SetQuantity() & GetQuantity()
Public member functions
SetDescription() mutator & GetDescription() accessor
StringOfItemCost()- Returns a string of the item name followed by the quantity, price, and subtotal
StringOfItemDescription()- Returns a string of the item name and description
Private data members
string itemDescription - Initialized in default constructor to "none" (see examples below)
string itemName - Initialized in default constructor to "none" (see examples below)
float itemPrice - Initialized in default constructor to 0
int itemQuantity - Initialized in default constructor to 0
Below are some examples of what some of the above class member functions would produce. Use these examples to test your program within you IDE.
Ex. of StringOfItemCost() returns a string in this format: (Hint: use ostringstream to produce this string):
Bottled Water 10 @ $1.00= $10.00
Note: Pay very close attention to the spacing in order to pass tests
Ex. of StringOfItemDescription() returns a string in this format: (Hint: use ostringstream to produce this string):
Bottled Water: Deer Park, 12 oz.
Note: Pay very close attention to the spacing in order to pass tests
You will also need some additional files:
ShoppingCart.h - Class declaration
ShoppingCart.cpp - Class definition
main.cpp - main() function
Utility.cpp - function definitions to support main.cpp functionality
Utility.h - function declarations to support main.cpp functionality
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
GetCustomerName() accessor
GetDate() accessor
AddItem()
Adds an item to cartItems vector. Has a parameter of type ItemToPurchase. Does not return anything.
RemoveItem()
Removes item from cartItems vector. Has a string (an item's name) parameter. 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 has default values for description, price, and quantity. If not, modify item in cart.
If item cannot be found (by name) in cart, output this message: Item not found in cart. Nothing modified.
GetNumItemsInCart()
Returns quantity of all items in cart. Has no parameters.
GetCostOfCart()
Determines and returns the total cost of items in cart. Has no parameters.
StringOfTotal()
returns a string of total of objects in cart. (see example below)
If cart is empty, is returns this message: SHOPPING CART IS EMPTY
StringOfDescriptions()
returns a string with each item's description. (see example below)
Below are examples

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!