project C ++ program for store

Anonymous
timer Asked: Nov 5th, 2016

Question description

the code to use on the project



#include <iostream>

#include <string.h>
using namespace std;

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
//Global Declarations
string    Introduction;    
int    Activity;
int    StartOverActivity;

//Variable used to manage item being worked on
int    ItemQuantity;
double    ItemPrice;
int    ItemNumber;
double GrandTotalSale;
//******************

double    BananaPrice = 2.50;
int    NumberOfBanana = 10;
double    BananaTotal = 0;

double    OrangePrice = 1.95;
int    NumberOfOrange = 5;
double    OrangeTotal;

void Display_Inventory();//function declaration
void Display_Report();//function declaration

int main() {
    

    
    cout << "Welcome to Prof Hyousseu Store Management System" << endl;
    cout << "Please follow all instructions as displayed!" << endl;
    
    //User do while loop to manage user main activity
    do
    {

        cout << "What activity would you like to perform next?" << endl;
        cout << "Please enter 1 for Inventory, 2 for Point of Sale, 3 for Report" << endl;
        cout << "Enter Selection: "; cin >> Activity; cout << endl;
        
        if(Activity == 1)
        {
            cout << endl;
            cout << "You chose to update the inventory" << endl;
            //Call the function to display inventory
            Display_Inventory();
            
            int    UpdatePerfomed;
            int    ContinueInventory = 1; //        0-Exit, 1-Start Inventory Activity Over        
            while(ContinueInventory == 1) // Start while loop to manage inventory
            {

                
                cout << "What item do you want to update? (Enter the item number below)" << endl;
                cout << "Item Number: "; cin >> ItemNumber; cout << endl;
                
                if(ItemNumber == 1)
                {
                    cout << "You chose Item 1: Bananas" << endl;
                    cout << "What do you want to update? Enter 1 for quantity or 2 for price" << endl;
                    
                    cout << "Selection: "; cin >> UpdatePerfomed; cout << endl;
                    
                    if(UpdatePerfomed == 1)//User selected to update quantity
                    {
                        cout << "Please enter the number the new item quantity" << endl;
                        cout << "Quantity: "; cin >> ItemQuantity; cout << endl;
                        NumberOfBanana = ItemQuantity; //Perform the update in the system
                        cout << "Update was successfull" << endl;
                    }
                    else if(UpdatePerfomed == 2)//User selected to update price
                    {
                        cout << "Please enter the number the new item price" << endl;
                        cout << "Price: "; cin >> ItemPrice; cout << endl;
                        BananaPrice = ItemPrice; //Perform the update in the system
                        cout << "Update was successfull" << endl;
                    }
                }
                
                if(ItemNumber == 2)
                {
                    cout << "You chose Item 1: Oranges" << endl;
                    cout << "What do you want to update? Enter 1 for quantity or 2 for price" << endl;
                    
                    cout << "Selection: "; cin >> UpdatePerfomed; cout << endl;
                    
                    if(UpdatePerfomed == 1)//User selected to update quantity
                    {
                        cout << "Please enter the number the new item quantity" << endl;
                        cout << "Quantity: "; cin >> ItemQuantity; cout << endl;
                        NumberOfOrange = ItemQuantity; //Perform the update in the system
                        cout << "Update was successfull" << endl;
                    }
                    else if(UpdatePerfomed == 2)//User selected to update price
                    {
                        cout << "Please enter the number the new item price" << endl;
                        cout << "Price: "; cin >> ItemPrice; cout << endl;
                        OrangePrice = ItemPrice; //Perform the update in the system
                        cout << "Update was successfull" << endl;
                    }
                }
                
                //Update token value
                cout << "Would you like to perform inventory on another item?" << endl;
                cout << "Enter 1 for Yes, and 0 for NO: "; cin >> ContinueInventory; cout << endl;
                
            }// End while loop to manage inventory
        
        
            
        }
        else if(Activity == 2) //User chose Point of Sale Activity
        {
            cout << "You chose to run the Cashier" << endl;
            int    ContinueSale = 1; //        0-Exit, 1-Start Sale Activity Over
            
            //Call the function to display inventory
            Display_Inventory();
            
            while(ContinueSale == 1) // Start while loop to manage Cashier Sale
            {
                //Ask user what items are being sold
                cout << "Please enter the item number being sold: " ; cin >> ItemNumber; cout << endl;
            
                if(ItemNumber == 1)
                {
                    cout << "You chose Item 1: Bananas" << endl;
                    cout << "How many items sold? Enter a number: "; cin >> ItemQuantity; cout << endl;
                    
                    cout << "You have sold " << ItemQuantity << " Bananas." << endl;
                    //Compute the sale total for the bananas being sold
                    BananaTotal = ItemQuantity * BananaPrice; // perfom operation
                    cout << "Banana Sale Total: $" << BananaTotal << endl;
                    
                    NumberOfBanana = NumberOfBanana - ItemQuantity;
                    cout << "New item inventory quantity: " << NumberOfBanana << endl;
                }
                
                if(ItemNumber == 2)
                {
                    cout << "You chose Item 1: Oranges" << endl;
                    cout << "How many items sold? Enter a number: "; cin >> ItemQuantity; cout << endl;
                    
                    cout << "You have sold " << ItemQuantity << " Bananas." << endl;
                    //Compute the sale total for the bananas being sold
                    OrangeTotal = ItemQuantity * OrangePrice; // perfom operation
                    cout << "Banana Sale Total: $" << OrangeTotal << endl;
                    
                    NumberOfOrange = NumberOfOrange - ItemQuantity;
                    cout << "New item inventory quantity: " << NumberOfOrange << endl;
                }
            
                //Update token value
                cout << "Would you like to enter another item sold?" << endl;
                cout << "Enter 1 for Yes, and 0 for NO: "; cin >> ContinueSale; cout << endl;
            }

        }
        else if (Activity == 3)
        {
            cout << "You chose to run the store summary" << endl;
            //Call the function to display summary report
            Display_Report();
            
        }
        
        //Update my token to evaluate whether to repeat loop
        cout << "Would you like to run another activity?" << endl;
        cout << "Enter 0 to Exit, 1 to continue" << endl;
        cout << "Choice: "; cin >> StartOverActivity;
        
    } while(StartOverActivity != 0);

    
    return 0;
}

void Display_Inventory() //function definition
{
    cout << endl;
    cout << "Item No" << "\t" << "Item" << "\t" << "Qty" << "\t" << "Price" << endl;
    cout << 1          << "\t" << "Bananas" << "\t" << NumberOfBanana << "\t" << "$" << BananaPrice << endl;
    cout << 2          << "\t" << "Oranges" << "\t" << NumberOfOrange << "\t" << "$" << OrangePrice << endl;                
    cout << endl;
}

void Display_Report() //function definition
{
    cout << endl;
    cout << "Item No" << "\t" << "Item" << "\t" << "Total/Sale" << endl;
    cout << 1          << "\t" << "Bananas" << "\t" << "$" << BananaTotal << endl;
    cout << 2          << "\t" << "Oranges" << "\t" << "$" << OrangeTotal << endl;                
    cout << endl;
    
    GrandTotalSale = BananaTotal + OrangeTotal;
    cout << "Grand Total is: $ " << GrandTotalSale << endl << endl;
    
}

Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags
Study Guides

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors