SlideShare a Scribd company logo
c++/main.cpp
#include <iostream>
#include "store.h"
#include <iomanip>
#include <cstdlib>
#include <exception>
using namespace std;
int main()
{
cout<<"t====Welcome to store======"<<endl;
int choice; //Users menu choosen
unsigned int index;
string category;
storeManager *sm=new storeManager();
item it; //Hold item to be stored;
while(true){
cout<<setw(6)<<setprecision(5)<<"t==========MENU=====
=========="<<endl;
cout<<setw(14)<<"tt 1. Create list (make store
empty)"<<endl;
cout<<setw(14)<<"tt 2. Add item to store"<<endl;
cout<<setw(14)<<"tt 3. Remove items from
store"<<endl;
cout<<setw(14)<<"tt 4. Display items (store)"<<endl;
cout<<setw(14)<<"tt 5. Display by category"<<endl;
cout<<setw(14)<<"tt 6. Add item to the cart"<<endl;
cout<<setw(14)<<"tt 7. Display shopping cart"<<endl;
cout<<setw(14)<<"tt 8. Delete items cart"<<endl;
cout<<setw(14)<<"tt 9. Quit"<<endl;
PR:
cout<<"choice $>>";
try{
cin>>choice;
}catch(...){cout<<"ttInvalid entry"<<endl;
goto PR;
}
switch(choice){
case 1:
sm->createStore();
break;
case 2:
cout<<"Enter item name"<<endl;
cin>>it.name;
cout<<"Enter location in store"<<endl;
cin>>it.location;
cout<<"Regular price"<<endl;
cin>>it.rprice;
cout<<"Seling price"<<endl;
cin>>it.sprice;
sm->addItem(it);
break;
case 3:
sm->displayList();
cout<<"Enter item index to remove"<<endl;
cin>>index;
sm->deleteItem(index);
break;
case 4:
sm->displayList(); //List of all items
break;
case 5:
cout<<"Enter category"<<endl;
cin>>category;
sm->displayList(category);
break;
case 6:
//Adds an item to the shoping cart
sm->displayList();
cout<<"Enter item Index"<<endl;
cin>>index;
sm->addShoppingList(index);
break;
case 7:
//display cart data
sm->displayCart();
break;
case 8:
sm->deleteCart();
break;
case 9:
exit(0);
break;
default:
cout<<"Invalid choice"<<endl;
}
}
cout<<"Bye"<<endl;
return 0;
}
c++/store.h
#ifndef STORE_H
#define STORE_H
#include <vector>
#include <iostream>
#include <iomanip>
using namespace std;
struct item{
string name; //Name of the item
string location; //Location in store
double rprice; //regular price
double sprice; //Sale Price
};
class storeManager{
private:
vector<item> storeItems; //Store items in the store
vector<item>::iterator f; //Used to navigate within the vector
list
vector<item> shopingList; //Holds item in the shopping list
public:
/**
* @brief storeManager contructor
*/
storeManager(){
storeItems.clear();
}
/**
* @brief createStore Empty store items
*/
void createStore(){
storeItems.clear();
}
/**
* @brief addItem add A new item to the list
* @param a item record to be stored into the vector
*/
void addItem(item &a){
storeItems.push_back(a);
cout<<"Item added"<<endl;
}
/**
* @brief deleteItem removes items from the list
* @param index index of item to remove
*/
void deleteItem(unsigned int index){
f=storeItems.begin();
if(f==storeItems.end()){
cout<<"Store empty"<<endl;
return;
}
if(index<storeItems.size()){
storeItems.erase(f+index-1);
}else{
cout<<"Item not available"<<endl;
}
}
/**
* @brief displayList displays al the items in the list
*/
void displayList(){
f=storeItems.begin();
int x=0;
item r; //Retrieved item
cout<<setw(6)<<"<SN"<<setw(6)<<"tItem"<<setw(7)<<"tLo
cation"<<setw(8)<<"tRegular price"<<setw(8)<<"tSale
price"<<endl;
while(f!=storeItems.end()){
r=*f;
x++;
cout<<setw(7)<<x;
cout<<setw(6)<<r.name;
cout<<setw(7)<<r.location;
cout<<setw(8)<<r.rprice;
cout<<setw(8)<<r.sprice<<endl;
f++;
}
}
/**
* @brief displayList display items in a given location in
store
* @param location Name of location to list items for
*/
void displayList(string location){
f=storeItems.begin();
item r; //Retrieved item
int x=0;
cout<<setw(7)<<"SN"<<setw(6)<<"tItem"<<setw(7)<<"tLoc
ation"<<setw(8)<<"tRegular price"<<setw(8)<<"tSale
price"<<endl;
while(f!=storeItems.end()){
r=*f;
if(r.location==location){
x++;
cout<<setw(7)<<x;
cout<<setw(7)<<r.name;
cout<<setw(7)<<r.location;
cout<<setw(7)<<r.rprice;
cout<<setw(7)<<r.sprice<<endl;
}
f++;
}
}
/**
* @brief displayCat display the summary of shopping Cart
*/
void displayCart(){
f=shopingList.begin();
if(f==shopingList.end()){
cout<<setw(7)<<"Shopping CART empty"<<endl;
return;
}
double totalProfit; //Profit from sales
double sellingP=0; //Seleing price
double buyingP=0; //Buying price
item r; //Retrieved item
int x=0; //counter
cout<<setw(7)<<"SN"<<setw(6)<<"tItem"<<setw(7)<<"tLoc
ation"<<setw(8)<<"tRegular price"<<setw(8)<<"tSale
price"<<endl;
while(f!=shopingList.end()){
r=*f;
x++;
cout<<setw(7)<<x;
cout<<setw(6)<<r.name;
cout<<setw(7)<<r.location;
buyingP+=r.rprice;
sellingP+=r.sprice;
cout<<setw(8)<<r.rprice;
cout<<setw(8)<<r.sprice<<endl;
f++;
}
totalProfit=sellingP-buyingP;
cout<<setw(20)<<"===Summary==="<<endl;
cout<<setw(25)<<"Total selling price: "<<set<<
sellingP<<endl;
cout<<setw(25)<<"Total buying price:
"<<setprecision(2)<<buyingP<<endl;
cout<<setw(25)<<"Total p-rofit:
"<<setprecision(2)<<totalProfit<<endl;
}
/**
* @brief addShoppingList add items to the shopping cart
* @param index index of item in the store
*/
void addShoppingList(unsigned int index){
//check to see that purchased items are not purchased
again
f=storeItems.begin();
if(index<(storeItems.size()- shopingList.size())){
shopingList.push_back(*(f+index)); //Add purchased
item
storeItems.erase(f+index); //Remove already purchased
items
}else{
cout<<"The item index does not exist"<<endl;
}
}
/**
* @brief deleteCart Deletes all items from the cart
*/
void deleteCart(){
shopingList.clear();
}
};
#endif // STORE_H
#include <iostream>
#include "store.h"
#include <iomanip>
#include <cstdlib>
#include <exception>
using namespace std;
int main()
{
cout<<"t====Welcome to store======"<<endl;
int choice; //Users menu choosen
unsigned int index;
string category;
storeManager *sm=new storeManager();
item it; //Hold item to be stored;
while(true){
cout<<setw(6)<<setprecision(5)<<"t==========MENU=====
=========="<<endl;
cout<<setw(14)<<"tt 1. Create list (make store
empty)"<<endl;
cout<<setw(14)<<"tt 2. Add item to store"<<endl;
cout<<setw(14)<<"tt 3. Remove items from
store"<<endl;
cout<<setw(14)<<"tt 4. Display items (store)"<<endl;
cout<<setw(14)<<"tt 5. Display by category"<<endl;
cout<<setw(14)<<"tt 6. Add item to the cart"<<endl;
cout<<setw(14)<<"tt 7. Display shopping cart"<<endl;
cout<<setw(14)<<"tt 8. Delete items cart"<<endl;
cout<<setw(14)<<"tt 9. Quit"<<endl;
PR:
cout<<"choice $>>";
try{
cin>>choice;
}catch(...){cout<<"ttInvalid entry"<<endl;
goto PR;
}
switch(choice){
case 1:
sm->createStore();
break;
case 2:
cout<<"Enter item name"<<endl;
cin>>it.name;
cout<<"Enter location in store"<<endl;
cin>>it.location;
cout<<"Regular price"<<endl;
cin>>it.rprice;
cout<<"Seling price"<<endl;
cin>>it.sprice;
sm->addItem(it);
break;
case 3:
sm->displayList();
cout<<"Enter item index to remove"<<endl;
cin>>index;
sm->deleteItem(index);
break;
case 4:
sm->displayList(); //List of all items
break;
case 5:
cout<<"Enter category"<<endl;
cin>>category;
sm->displayList(category);
break;
case 6:
//Adds an item to the shoping cart
sm->displayList();
cout<<"Enter item Index"<<endl;
cin>>index;
sm->addShoppingList(index);
break;
case 7:
//display cart data
sm->displayCart();
break;
case 8:
sm->deleteCart();
break;
case 9:
exit(0);
break;
default:
cout<<"Invalid choice"<<endl;
}
}
cout<<"Bye"<<endl;
return 0;
}
The program should display a list of items and the location in
the store.
The user must be able to enter the items and location in the
store.
You will use a class for the items. For this assignment you will
implement creating the list, adding elements, removing
elements, and displaying the shopping list.
There is other information. Some people shop on a budget so
they need the price and the sale price. Use an array or vector to
hold the list of items.
The display should show the items by zone or location within
the store. (Display the output by location.)
Summary:
1. Implement a shopping list program that asks the user for the
name of the product – you need to have class item. Use an array
or vector to hold the list of items.
2. The user also needs to enter the location (it can be isle
number that will be translated into product category (for
example poultry, baby items, hygiene, etc). You can be creative
here. Use an array or vector to hold the list of items.
3. The user also needs to add regular price and sales price, if
the product is on sale.
4. The user should be able to add as many products as they want
5. The user should be able to remove item from the list (Use
menu).
6. The user should be able to display shopping list. The display
should show the items by zone or location within the store. Also
display should show the regular and sales price of the item as
well as compute the total bill and total savings.

More Related Content

PDF
12.9 Program Online shopping cart (continued) (C++)This program e.pdf
PDF
I finished most of the program, but having trouble with some key fea.pdf
DOCX
#include iostream#include stringusing namespace std;.docx
DOCX
CS Project-Source code for shopping inventory for CBSE 12th
DOCX
computer project on shopping mall..cbse 2017-2018 project
PDF
So I already have most of the code and now I have to1. create an .pdf
PDF
I have the first program completed (not how request, but it works) a.pdf
PDF
Kirti Kumawat, BCA Third Year
12.9 Program Online shopping cart (continued) (C++)This program e.pdf
I finished most of the program, but having trouble with some key fea.pdf
#include iostream#include stringusing namespace std;.docx
CS Project-Source code for shopping inventory for CBSE 12th
computer project on shopping mall..cbse 2017-2018 project
So I already have most of the code and now I have to1. create an .pdf
I have the first program completed (not how request, but it works) a.pdf
Kirti Kumawat, BCA Third Year

Similar to c++main.cpp#include iostream#include store.h#includ.docx (20)

PDF
Reshma Kodwani , BCA Third Year
DOCX
Supermarket
PDF
Computer science class 12 project on Super Market Billing
PDF
computerscience-170129081612.pdf
PDF
cs project work on canteen managment
PPT
C++ super market
DOC
Shopping mall
PDF
Shopping mall management
PDF
C programming tweak needed for a specific program.This is the comp.pdf
PDF
Harsh Mathur project c++
PDF
Harsh Mathur, BCA-2 Year
DOCX
Billing in a supermarket c++
TXT
c++ project on restaurant billing
DOCX
Canteen management
PDF
#include stdafx.h#include iostreamusing namespace std;cl.pdf
PDF
Durgesh
DOCX
Program Specifications Develop an inventory management system for an e.docx
PDF
show code and all classes with full implementation for these Program S.pdf
DOCX
You are to write a program that computes customers bill for hisher.docx
PDF
Computer Investigatory Project
Reshma Kodwani , BCA Third Year
Supermarket
Computer science class 12 project on Super Market Billing
computerscience-170129081612.pdf
cs project work on canteen managment
C++ super market
Shopping mall
Shopping mall management
C programming tweak needed for a specific program.This is the comp.pdf
Harsh Mathur project c++
Harsh Mathur, BCA-2 Year
Billing in a supermarket c++
c++ project on restaurant billing
Canteen management
#include stdafx.h#include iostreamusing namespace std;cl.pdf
Durgesh
Program Specifications Develop an inventory management system for an e.docx
show code and all classes with full implementation for these Program S.pdf
You are to write a program that computes customers bill for hisher.docx
Computer Investigatory Project
Ad

More from humphrieskalyn (20)

DOCX
Evaluate the role of leadership on organizational behaviorProv.docx
DOCX
Evaluate the role that PKI plays in cryptography.Ensure that you.docx
DOCX
Evaluate the presence and effects of alteration in the homeostatic s.docx
DOCX
Evaluate the role of a digital certificate in cryptography.  How doe.docx
DOCX
Evaluate the merits of Piaget’s stage theory for explaining cognitiv.docx
DOCX
Evaluate the notion that white collar offenders are intrinsically di.docx
DOCX
EV 551 Hazardous Materials Assessment – Summer2020Homework 1 – 4.docx
DOCX
Evaluate the history of cryptography from its origins.  Analyze how .docx
DOCX
Evaluate the evidence provided by Apollo Shoes.Decide how to s.docx
DOCX
Evaluate the Health History and Medical Information for Mrs. J.,.docx
DOCX
Evaluate the current state of the health care system in Sacramento. .docx
DOCX
Evaluate the advantages and disadvantages of the various decis.docx
DOCX
Evaluate some technologies that can help with continuous monitoring..docx
DOCX
Evaluate progress on certification plansReport your prog.docx
DOCX
Evaluate how you have achieved course competencies and your plans to.docx
DOCX
Evaluate how information privacy and security relates to the Interne.docx
DOCX
Evaluate assessment of suicide in forensic settings andor cri.docx
DOCX
Evaluate different approaches to ethical decision making. Then, choo.docx
DOCX
Evaluate and grade websites in terms of their compliance with PL pri.docx
DOCX
Evaluate at least (2) factors that make financial statement analys.docx
Evaluate the role of leadership on organizational behaviorProv.docx
Evaluate the role that PKI plays in cryptography.Ensure that you.docx
Evaluate the presence and effects of alteration in the homeostatic s.docx
Evaluate the role of a digital certificate in cryptography.  How doe.docx
Evaluate the merits of Piaget’s stage theory for explaining cognitiv.docx
Evaluate the notion that white collar offenders are intrinsically di.docx
EV 551 Hazardous Materials Assessment – Summer2020Homework 1 – 4.docx
Evaluate the history of cryptography from its origins.  Analyze how .docx
Evaluate the evidence provided by Apollo Shoes.Decide how to s.docx
Evaluate the Health History and Medical Information for Mrs. J.,.docx
Evaluate the current state of the health care system in Sacramento. .docx
Evaluate the advantages and disadvantages of the various decis.docx
Evaluate some technologies that can help with continuous monitoring..docx
Evaluate progress on certification plansReport your prog.docx
Evaluate how you have achieved course competencies and your plans to.docx
Evaluate how information privacy and security relates to the Interne.docx
Evaluate assessment of suicide in forensic settings andor cri.docx
Evaluate different approaches to ethical decision making. Then, choo.docx
Evaluate and grade websites in terms of their compliance with PL pri.docx
Evaluate at least (2) factors that make financial statement analys.docx
Ad

Recently uploaded (20)

PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Institutional Correction lecture only . . .
PDF
Classroom Observation Tools for Teachers
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Cell Structure & Organelles in detailed.
PPTX
Presentation on HIE in infants and its manifestations
PPTX
master seminar digital applications in india
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Microbial diseases, their pathogenesis and prophylaxis
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Microbial disease of the cardiovascular and lymphatic systems
Institutional Correction lecture only . . .
Classroom Observation Tools for Teachers
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Computing-Curriculum for Schools in Ghana
Cell Structure & Organelles in detailed.
Presentation on HIE in infants and its manifestations
master seminar digital applications in india
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
O7-L3 Supply Chain Operations - ICLT Program
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
VCE English Exam - Section C Student Revision Booklet
Chinmaya Tiranga quiz Grand Finale.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf

c++main.cpp#include iostream#include store.h#includ.docx

  • 1. c++/main.cpp #include <iostream> #include "store.h" #include <iomanip> #include <cstdlib> #include <exception> using namespace std; int main() { cout<<"t====Welcome to store======"<<endl; int choice; //Users menu choosen unsigned int index; string category; storeManager *sm=new storeManager(); item it; //Hold item to be stored; while(true){
  • 2. cout<<setw(6)<<setprecision(5)<<"t==========MENU===== =========="<<endl; cout<<setw(14)<<"tt 1. Create list (make store empty)"<<endl; cout<<setw(14)<<"tt 2. Add item to store"<<endl; cout<<setw(14)<<"tt 3. Remove items from store"<<endl; cout<<setw(14)<<"tt 4. Display items (store)"<<endl; cout<<setw(14)<<"tt 5. Display by category"<<endl; cout<<setw(14)<<"tt 6. Add item to the cart"<<endl; cout<<setw(14)<<"tt 7. Display shopping cart"<<endl; cout<<setw(14)<<"tt 8. Delete items cart"<<endl; cout<<setw(14)<<"tt 9. Quit"<<endl; PR: cout<<"choice $>>"; try{ cin>>choice; }catch(...){cout<<"ttInvalid entry"<<endl; goto PR;
  • 3. } switch(choice){ case 1: sm->createStore(); break; case 2: cout<<"Enter item name"<<endl; cin>>it.name; cout<<"Enter location in store"<<endl; cin>>it.location; cout<<"Regular price"<<endl; cin>>it.rprice; cout<<"Seling price"<<endl; cin>>it.sprice; sm->addItem(it); break; case 3: sm->displayList();
  • 4. cout<<"Enter item index to remove"<<endl; cin>>index; sm->deleteItem(index); break; case 4: sm->displayList(); //List of all items break; case 5: cout<<"Enter category"<<endl; cin>>category; sm->displayList(category); break; case 6: //Adds an item to the shoping cart sm->displayList(); cout<<"Enter item Index"<<endl; cin>>index; sm->addShoppingList(index);
  • 5. break; case 7: //display cart data sm->displayCart(); break; case 8: sm->deleteCart(); break; case 9: exit(0); break; default: cout<<"Invalid choice"<<endl; } } cout<<"Bye"<<endl; return 0; }
  • 6. c++/store.h #ifndef STORE_H #define STORE_H #include <vector> #include <iostream> #include <iomanip> using namespace std; struct item{ string name; //Name of the item string location; //Location in store double rprice; //regular price double sprice; //Sale Price }; class storeManager{ private: vector<item> storeItems; //Store items in the store vector<item>::iterator f; //Used to navigate within the vector
  • 7. list vector<item> shopingList; //Holds item in the shopping list public: /** * @brief storeManager contructor */ storeManager(){ storeItems.clear(); } /** * @brief createStore Empty store items */ void createStore(){ storeItems.clear(); } /** * @brief addItem add A new item to the list
  • 8. * @param a item record to be stored into the vector */ void addItem(item &a){ storeItems.push_back(a); cout<<"Item added"<<endl; } /** * @brief deleteItem removes items from the list * @param index index of item to remove */ void deleteItem(unsigned int index){ f=storeItems.begin(); if(f==storeItems.end()){ cout<<"Store empty"<<endl; return; } if(index<storeItems.size()){
  • 9. storeItems.erase(f+index-1); }else{ cout<<"Item not available"<<endl; } } /** * @brief displayList displays al the items in the list */ void displayList(){ f=storeItems.begin(); int x=0; item r; //Retrieved item cout<<setw(6)<<"<SN"<<setw(6)<<"tItem"<<setw(7)<<"tLo cation"<<setw(8)<<"tRegular price"<<setw(8)<<"tSale price"<<endl; while(f!=storeItems.end()){ r=*f; x++; cout<<setw(7)<<x;
  • 10. cout<<setw(6)<<r.name; cout<<setw(7)<<r.location; cout<<setw(8)<<r.rprice; cout<<setw(8)<<r.sprice<<endl; f++; } } /** * @brief displayList display items in a given location in store * @param location Name of location to list items for */ void displayList(string location){ f=storeItems.begin(); item r; //Retrieved item int x=0; cout<<setw(7)<<"SN"<<setw(6)<<"tItem"<<setw(7)<<"tLoc ation"<<setw(8)<<"tRegular price"<<setw(8)<<"tSale price"<<endl;
  • 12. f=shopingList.begin(); if(f==shopingList.end()){ cout<<setw(7)<<"Shopping CART empty"<<endl; return; } double totalProfit; //Profit from sales double sellingP=0; //Seleing price double buyingP=0; //Buying price item r; //Retrieved item int x=0; //counter cout<<setw(7)<<"SN"<<setw(6)<<"tItem"<<setw(7)<<"tLoc ation"<<setw(8)<<"tRegular price"<<setw(8)<<"tSale price"<<endl; while(f!=shopingList.end()){ r=*f; x++; cout<<setw(7)<<x; cout<<setw(6)<<r.name;
  • 13. cout<<setw(7)<<r.location; buyingP+=r.rprice; sellingP+=r.sprice; cout<<setw(8)<<r.rprice; cout<<setw(8)<<r.sprice<<endl; f++; } totalProfit=sellingP-buyingP; cout<<setw(20)<<"===Summary==="<<endl; cout<<setw(25)<<"Total selling price: "<<set<< sellingP<<endl; cout<<setw(25)<<"Total buying price: "<<setprecision(2)<<buyingP<<endl; cout<<setw(25)<<"Total p-rofit: "<<setprecision(2)<<totalProfit<<endl; } /** * @brief addShoppingList add items to the shopping cart * @param index index of item in the store */
  • 14. void addShoppingList(unsigned int index){ //check to see that purchased items are not purchased again f=storeItems.begin(); if(index<(storeItems.size()- shopingList.size())){ shopingList.push_back(*(f+index)); //Add purchased item storeItems.erase(f+index); //Remove already purchased items }else{ cout<<"The item index does not exist"<<endl; } } /** * @brief deleteCart Deletes all items from the cart */ void deleteCart(){ shopingList.clear(); }
  • 15. }; #endif // STORE_H #include <iostream> #include "store.h" #include <iomanip> #include <cstdlib> #include <exception> using namespace std; int main() { cout<<"t====Welcome to store======"<<endl; int choice; //Users menu choosen unsigned int index; string category; storeManager *sm=new storeManager(); item it; //Hold item to be stored;
  • 16. while(true){ cout<<setw(6)<<setprecision(5)<<"t==========MENU===== =========="<<endl; cout<<setw(14)<<"tt 1. Create list (make store empty)"<<endl; cout<<setw(14)<<"tt 2. Add item to store"<<endl; cout<<setw(14)<<"tt 3. Remove items from store"<<endl; cout<<setw(14)<<"tt 4. Display items (store)"<<endl; cout<<setw(14)<<"tt 5. Display by category"<<endl; cout<<setw(14)<<"tt 6. Add item to the cart"<<endl; cout<<setw(14)<<"tt 7. Display shopping cart"<<endl; cout<<setw(14)<<"tt 8. Delete items cart"<<endl; cout<<setw(14)<<"tt 9. Quit"<<endl; PR: cout<<"choice $>>"; try{ cin>>choice; }catch(...){cout<<"ttInvalid entry"<<endl;
  • 17. goto PR; } switch(choice){ case 1: sm->createStore(); break; case 2: cout<<"Enter item name"<<endl; cin>>it.name; cout<<"Enter location in store"<<endl; cin>>it.location; cout<<"Regular price"<<endl; cin>>it.rprice; cout<<"Seling price"<<endl; cin>>it.sprice; sm->addItem(it); break; case 3:
  • 18. sm->displayList(); cout<<"Enter item index to remove"<<endl; cin>>index; sm->deleteItem(index); break; case 4: sm->displayList(); //List of all items break; case 5: cout<<"Enter category"<<endl; cin>>category; sm->displayList(category); break; case 6: //Adds an item to the shoping cart sm->displayList(); cout<<"Enter item Index"<<endl; cin>>index;
  • 19. sm->addShoppingList(index); break; case 7: //display cart data sm->displayCart(); break; case 8: sm->deleteCart(); break; case 9: exit(0); break; default: cout<<"Invalid choice"<<endl; } } cout<<"Bye"<<endl; return 0;
  • 20. } The program should display a list of items and the location in the store. The user must be able to enter the items and location in the store. You will use a class for the items. For this assignment you will implement creating the list, adding elements, removing elements, and displaying the shopping list. There is other information. Some people shop on a budget so they need the price and the sale price. Use an array or vector to hold the list of items. The display should show the items by zone or location within the store. (Display the output by location.) Summary: 1. Implement a shopping list program that asks the user for the name of the product – you need to have class item. Use an array or vector to hold the list of items. 2. The user also needs to enter the location (it can be isle number that will be translated into product category (for example poultry, baby items, hygiene, etc). You can be creative here. Use an array or vector to hold the list of items.
  • 21. 3. The user also needs to add regular price and sales price, if the product is on sale. 4. The user should be able to add as many products as they want 5. The user should be able to remove item from the list (Use menu). 6. The user should be able to display shopping list. The display should show the items by zone or location within the store. Also display should show the regular and sales price of the item as well as compute the total bill and total savings.