Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Inventory system: Develop an Product base class to keep track of the products. Y

ID: 3705720 • Letter: I

Question

Inventory system: Develop an Product base class to keep track of the products. You need to keep track of the following information in the class: . Item number .Name Cost o Your class needs to have methods that perform the following actions: .A default constructor A constructor to initialize the item when you read them in from the file .A destructor . Get the Item Number .Get the Name -Get the Cost Get the Qty . Set the Qty .Set the Cost Develop an Inventory class that is derived from the Product class. o Your Inventory class should create a dynamic array of objects (products). You will read in from the text file all the products and store them in the array o Your Inventory class should have the following functionality Be able to add new products Update product information Oty and Cost. Delete products When you program starts you will ask if you are a customer or admin. If they select Admin then you allow them to use the Admin interface. If they select customer they must use the shopper interface. You can have them type an "A" or "C" to select the appropriate interface. Develop a Admin user interface: . Admin interface: o Allow the admin to add products to the inventory o Allow the admin to update qty of products on hand o Allow the admin to change the price of products o Allow the admin to delete products When the admin is done then the program should write the new inventory information back to the inventory.csv file Do not exit the program go back to the prompt to ask if you

Explanation / Answer

//product base class

class Product{

//access specifier

public:

//variables

int ItemNumber;

string Name;

int cost;

int qty;

//constructor

Product(int num, string nam, int cos, int qt){

ItemNumber = num;

Name = nam;

cost = cos;

qty = qt;

}

//deconstructor

-Product(){

ItemNumber = null;

Name = null;

cost = null;

qty = null;

}

//getter methods

int getItemNumber(){

return ItemNumber;

}

string getName(){

return Name;

}

int getCost(){

return cost;

}

int getQty(){

return qty;

}

//setterbmethods

void setQty(int qt){

qty = qt;

}

void setCost(int cos){

cost = cos;

}

};

//inventory class

clas Inventory{

//public specifier

public:

//variables

Product *products;

//methods

//ading new products

void addProduct(Product prod){

if(products == null) {

products = new Product[1];

products[0] = prod

}

else{

int size = sizeof(products);

Product *prods = new Product[size+1];

for(int i=0; i<size;i++){

prods[i] = products[i];

}

prods[size] = prod;

products = prods;

}

}

//updating existing products

void updateProds(int num, int qt, int cos){

for(int i =0;i<sizeof(products);i++){

if(products[i].ItemNumber == num){

products[i].setCost(cos);

products[i].setQty(qt);

}

}

}

//deleting a product

void deleteProduct(int num){

Product *prods = new Product[sizeof(products)-1];

int check =0;

for(int i=0;i<sizeof(products);i++){

if(products[i].getItemNumber() == num){

check =1;

}

else{

prods[i-check] = products[i];

}

}

products = prods;

}

}

int main(){

//asking user input

cout << "Continue as Admin(A) or Shopper(C) ? ";

char in;

cin >> in;

while(true){

if(in == 'A'){

cout << "Choose an Admin option 1. Add a product 2. Update a product 3.Delete a product 4. Exit"

}

if(in == 'C'){

cout << "Choose an Shopper option 1. Add a product to cart 2. Change qty of product in cart 3. remove product from cart 4. Exit"

}

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote