Question: Separate the item class and the user class, into 2 files file.cpp and file.h and how to enter it in the main menu User class
Separate the item class and the user class, into files
file.cpp and file.h and how to enter it in the main menu
User class
#include
#include
#include
using namespace std;
class User
private:
string username;
string password;
public:
Userconst string & user, const string & pass : usernameuser passwordpass
bool authenticateconst string & inputUser, const string & inputPass const
return username inputUser && password inputPass;
static bool validateUserconst string & inputUser, const string & inputPass
ifstream fileusertxt;
if file.isopen
cerr "Error opening file" endl;
return false;
string storedUser, storedPass;
while file storedUser storedPass
if storedUser inputUser && storedPass inputPass
return true;
return false;
;
Item class
#include
using namespace std;
class Item
private:
string name;
double price;
int quantity;
public:
Itemconst string & name, double price, int quantity : namename priceprice quantityquantity
string getName const
return name;
double getPrice const
return price;
void setQuantityint newQuantity
quantity newQuantity;
int getQuantity const
return quantity;
;
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
