You are required to implement a shopping cart module for an online shopping mall. From the available
items a user will select the item to purchase and add this into his shopping cart. Before the checkout
customer can remove any item from the cart at any time.
A single item in the cart contains the following details:
class Item
{
private:
int itemID;
string itemName;
double price;
double purchasedQuantity;
double totalPrice;
public:
//constructors and getter setters
};
For the implementation of the required module you have to meet the following requirements:
3- Customer can also view his cart at any time. You have to provide two features for the user in order
to view his cart:
i. View cart: it will display all the items that customer selected to purchase.
ii. View cart by items: Display one item and facilitate user to navigate through next or
previous item in the cart till the user wants to quit the view.
class Item
{
public:
Item(string itemName, int price, int purchasedQuantity, int itemID);
void totalPrice()
{
cout << "Total price: " << price * purchasedQuantity << endl;
}
private:
int itemID;
string itemName;
double price;
double purchasedQuantity;
double totalPrice;
};
Comments
Leave a comment