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

GROCERY POINT OF SALE SYSTEM We need a point of sale system for the new grocery

ID: 3566544 • Letter: G

Question

GROCERY POINT OF SALE SYSTEM We need a point of sale system for the new grocery store I am planning to open. Here are the main features of this program: 1) Enter a Product This feature allows user to enter a new product into the system. Program asks store owner to enter a product name (ex. Snicker, SpringWater etc). quantity (how many of this product in inventory), and sale price. Assume that product name does not have any space in it. If the product already exist, tell store owner that the product is already in inventory. 2) Change Inventory This feature allows store owner to change the quantity of a product in the inventory. Program asks user for the name of the product and new quantity. It will search the products in the system, find the product user specified and change its quantity to the new number specified by store owner. 3) Make Sale This feature allows store owner to record the sale of a product. Program asks user for the name of the product and how many of this product is sold. It will search the products in the system, find the product user specified and deducts the specified quantity from the inventory. 4) Inventory Report This feature allows store owner to display inventory report. The report should display each product on a separate line. For each product, display the name, sale price and quantity. At the end of the report also display the worth of the whole inventory, worth of each product is quantity of that product times the sale price. the worth of the whole inventory is the sum of the worth of all products. 5) Exit Exits the program. Make sure that your program is presentable, user friendly (25 points). Avoid Penalties: - Each feature must be in a separate function (-50). You must use arrays to hold the data (-50) - Your program does not compile and/or crashes while running (-50). - Your program is not properly indented and commented (-50). Assume that I will deduct the maximum amount if you hi these penalties. I will also deduct the maximum amount if any of the features of the program is not functioning properly.

Explanation / Answer

#include<iostream>
#include<string.h>

using namespace std;

string productName[100];
int quantity[100];
double salePrice[100];
int count = 0;

void product(){
cout << "Enter product name: ";
cin >> productName[count];
for(int i=0; i<count; i++){
if(productName[count].compare(productName[i]) == 0){
cout << "Product Already exist ";
return;
}
}
cout << "Enter quantity: ";
cin >> quantity[count];
cout << "Enter Sale Price: $";
cin >> salePrice[count];
count++;
}

void changeInventory(){
string name;
cout << "Enter name of product: ";
cin >> name;
int flag =0;
for(int i=0; i<count; i++){
if(name.compare(productName[i]) != 0){
cout << "Enter the new quantity value: ";
cin >> quantity[i];
flag = 1;
break;
}
}
if(flag == 0){
cout << "Product not present ";
}
}

void makeSale(){
string name;
cout << "Enter name of product: ";
cin >> name;
int quan;
int flag =0;
for(int i=0; i<count; i++){
if(name.compare(productName[i]) != 0){
cout << "Enter quantity sold: ";
cin >> quan;
quantity[i] -= quan;
flag = 1;
break;
}
}
if(flag == 0){
cout << "Product not present ";
}
}

void report(){
double worth = 0;
for(int i=0 ;i< count; i++){
cout << productName[i] << " " << quantity[i] << " " << salePrice[i] << endl;
worth = worth + (quantity[i]*salePrice[i]);
}
cout << "The total worth of the inventory is $" << worth << endl;
}

int main(){
int choice;
do{
cout << "***************************************** ";
cout << "***************** MENU **************** ";
cout << "****************************************** ";
cout << "1. Enter a product ";
cout << "2. Change Inventory ";
cout << "3. Make Sale ";
cout << "4. Report ";
cout << "5. Exit ";
cout << "Enter your choice : ";
cin >> choice;

switch(choice){
case 1:
product();
break;
case 2:
changeInventory();
break;
case 3:
makeSale();
break;
case 4:
report();
break;
case 5:
cout << "Exiting From the program ....... ";
return 0;
default :
cout << "Invalid choice Enter again ";
}
}while(1);
return 0;
}