Question: I need help to separate this code by classes, article class and user class #include I need help separating this code by classes, item class
I need help to separate this code by classes, article class and user class
#include
I need help separating this code by classes, item class and user class.
#include
#include
#include
#include "user.h
#include "article.h
using the standard namespace;
int main
fstream file;
string user, pass;
string fuser, fpass;
vectorcart;
inner band ;
file.openusertxt;
if file.isopen
cout "Error opening file" endl;
return ;
cout "User: ;
cin user;
cout "Password: ;
cin pass;
while file.eof
file fuser fpass;
if fuser user && fpass pass
band ;
break;
file.close;
if band
item objPaper;
item objFeather;
item objLaptop;
item objPencil;
item objDraft;
vector items obj obj obj obj obj;
internal choice;
do
cout Welcome to my online store election;
change choice
Case :
int subselection;
cout "How would you like to consult the articles?
;
cout Prices below a certain quantity.
;
cout Prices above a certain quantity
;
cout Name
;
cout "Enter your choice: ;
cin subselection;
int pricelimit;
string itemName;
changesuboption
Case :
case :
cout "Enter price limit: ;
cin price limit;
break;
case :
cout "Enter the element name: ;
cin itemname;
break;
cout "Available elements:
;
for int i ; i items.size; i
bool display false;
if subchoice && itemsigetPrice priceLimit display true;
if subchoice && itemsigetName item name display true;
if show
cout i itemsigetName Price: $ itemsigetPrice endl;
charad;
cout Do you want to add an item to your cart? YN: ;
cin add;
if add Y
int itemNumber, quantity;
cout "Enter item number: ;
cin item number;
cout "How many pieces?";
cin quantity;
itemsitemNum setQuantityquantity;
cart.pushbackitemsitemNum ;
cout "Item added to cart.
;
continuous chain;
cout Do you want to exit to the main menu or continue adding items? MenuAdd: ;
cin cont;
while cont "Add"
int itemNumber, quantity;
cout "Enter item number: ;
cin item number;
cout "How many pieces?";
cin quantity;
itemsitemNum setQuantityquantity;
cart.pushbackitemsitemNum ;
cout "Item added to cart.
;
cout Do you want to exit to the main menu or continue adding items? MenuAdd: ;
cin cont;
break;
case :
cout "Your cart:
;
total integer ;
for int i ; i cart.size; i
cout i cartigetName Price: $ cartigetPrice Quantity: cart igetQuantity endl;
total cartigetPrice cartigetQuantity;
cout "Total to pay: $ total endl;
string buyOrCont;
cout Do you want to finish or continue shopping? FinishBuy: ;
cin buyOrCont;
if buyOrCont "Finish"
cout "Press Ok to close the sale..
;
string Ok;
cin Ok;
if Okay "Okay"
cout "Sale successfully closed. Thank you for shopping with us
;
cart.clear;
break;
case :
cout "Leaving...
;
break;
default:
cout "Invalid choice. Please enter again.
;
break;
while choice ;
the rest
cout "Invalid username or password. Please try again.
;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
