• Home
  • Blog
  • create C ++ program advanced calculator, computer science homework help

create C ++ program advanced calculator, computer science homework help

0 comments

Use the advanced calculator object you have developed in the class and integrate it (10 pts) in a store Management System (object) with the following capabilities (10 pts):

Maintain the Inventory and price of items in the store (10 pts)

Implement a point of sale menu for customer purchases (10 pts)

Provide a summary of daily sales and revenues in a report style format (10 pts), by categories and then grand total (10 pts)

The goods offered for sale in a merchants shop (with fixed prices) are: Bananas ($2.50), Oranges ($1.95), Apples ($2.85), Milk ($3.89), Bread ($1.25), Cake ($5.20), Light Bulbs ($1.30), and extension cords ($3.99). Please augment at least 5 or more additional items.

Create a working computer program in C++ programming language: 10 points

Write a Project Report with the following section at a minimum with meaningful content: Background and Introduction, Problem Statement, Solution & Algorithm, Discussion and Analysis, Future Work and Conclusion. 20pts

Comment your code and identify with explanation where each of the following features is implemented in your computer program: (10 pts)

Parts of a computer program, Declarations, use of Function Declarations / Functions Definition/Function Call, Objects Definition, use of Objects, use of Control Statements (while/Do-While Loop, for Loop, Use of if / if-else, switch, others), use of Relational Operators, Use of Logical Operators, Use of Compound Operators, use of Calculator methods and data members via access operator, formating methods and operators/functions. (20 points Bonus if all features are implemented)

#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;
    
}

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}