Before the checkout customer can remove any item from the cart at any time.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question
100%

Instruction:please do not use advanced c++ for this scenario just use double linked list in c++

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:
1- Customer can add any item to the cart in desired quantity.
Remember if customer added the same item in the cart again, your implementation will not add this as a new
item it will check if the item already exists than it will just add the new quantity in the previous and update
other data.
2- Customer can remove item or change the quantity at any time.
There are two possibilities:
i. Customer wants to remove the item form the cart
ii. Customer wants to change the quantity of item in the cart

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.

4- Customer can calculate his bill. Bill will be calculated according to the item price and the number
of items he wants to purchase.
5- Bill should be displayed in user friendly manner to the customer.
You have to provide implementation of following methods for the Cart class.
 addToCart( int itemID,string itemName,double price, int purchasedQuantity);
 addExistingToCart(int itemID, int quantityToAdd);
 removeFromCart(item itemToRemove);
 void changeQuantity : (int itemID, int newQuantity);
 calculateBill();
 printBill();
 viewCartByItem();
 viewCart();

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Probability Problems
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning