Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Help with this problem with functions/classes/structures

$
0
0
 
    #ifndef STORE_H
    #define STORE_H
    #include <iostream>
    #include <iomanip>
    using namespace std;
    class Store
    {
    public:
    Store( );
    Store (int, char[], int, double, double, int, double);
    int GetProductIDNumber ( )const;
    char const* GetDescription ( )const;
    int GetManufacturersIDNumber ( )const;
    double GetPrice ( )const;
    double GetPercentage ( )const;
    int GetInventory ( )const;
    void Display ()const;
    double const RetailPrice ( )const;
    private:
    int ProductIDNumber;
    char Description [25];
    int ManufacturersIDNumber;
    double Price;
    double Percentage;
    int Inventory;
    };
    #endif

Implementation file

    #include "Store.h"
    Store::Store()
    {
    ProductIDNumber = 0;
    Description[24] = '\0';
    ManufacturersIDNumber = 0;
    Price = 0;
    Percentage = 0;
    Inventory = 0;
    }
    Store::Store (int InitProductIDNumber, char InitDescription[], int InitManufacturersIDNumber,
    double InitPrice, double InitPercentage, int InitInventory, double InitRetailPrice)
    {
    ProductIDNumber = InitProductIDNumber;
    strcpy_s( Description, InitDescription );
    ManufacturersIDNumber = InitManufacturersIDNumber;
    Price = InitPrice;
    Percentage = InitPercentage;
    Inventory = InitInventory;
    }
    int Store::GetProductIDNumber() const
    {
    return( ProductIDNumber );
    }
    char const* Store::GetDescription() const
    {
    return( Description );
    }
    int Store::GetManufacturersIDNumber() const
    {
    return( ManufacturersIDNumber );
    }
    double Store::GetPrice() const
    {
    return ( Price );
    }
    double Store::GetPercentage() const
    {
    return( Percentage );
    }
    int Store::GetInventory() const
    {
    return( Inventory );
    }
    void Store::Display() const
    {

    <<"Identification Number: "
    <<setw (15)<< GetProductIDNumber()<<endl;
    cout<<setw(20)<<setfill(' ')
    <<"Description: "
    <<setw (23) << GetDescription()<<endl;
    cout<<setw(21)<<setfill(' ')
    <<"Manufacturer: "
    <<setw(22)<< GetManufacturersIDNumber()<<endl;
    cout<<setw(24)<<setfill(' ')
    <<"Wholesale Price: "
    <<setw(19)<< GetPrice ()<<endl;
    cout<<setw(22)<<setfill(' ')
    <<"Mark-up Price: "
    <<setw(21)<< GetPercentage()<<endl;
    cout<<setw(25)<<setfill(' ')
    <<"Quanity In stock: "
    <<setw(18)<<GetInventory()<<endl;
   
    }
    double const Store::RetailPrice()const
    {
    return((Price*Percentage)+Price);
    }

CPP Client Code here

    #include "Store.h"
    int main()
    {
    int InitProductIDNumber = 0;
    char InitDescription[24] = "\0";
    int InitManufacturersIDNumber = 0;
    double InitPrice = 0;
    double InitPercentage = 0;
    int InitInventory = 0;
    double InitRetailPrice = 0;
    char NextChar= '\0';
    char ContinuationFlag = 'Y';
    while (toupper(ContinuationFlag) == 'Y')
    {
    cout<<endl;
    cout<< "Enter the products ID Number: "<<endl;
    cin>> InitProductIDNumber;
    cout<< "Enter the products Manufacturer's ID Number: "<<endl;
    cin>> InitManufacturersIDNumber;
    cout<< "Enter the products wholesale price: "<<endl;
    cin>> InitPrice;
    cout<< "Enter the product's mark-up percentage: "<<endl;
    cin>> InitPercentage;
    cout<< "Enter the product's description: "<<endl;
    NextChar = cin.peek();
    if ( NextChar =='\n')
    {
    cin.ignore( );
    }
    cin.get (InitDescription, 24);
    cout<< "Enter the quantity of the product in stock: "<<endl;
    cin>> InitInventory;
    Store InventoryItem (InitProductIDNumber, InitDescription, InitManufacturersIDNumber, InitPrice, InitPercentage,
    InitInventory, RetailPrice);
    InventoryItem.Display();
    cout<<endl;
    cout<< "Office Supply Product Retail Price: "<<RetailPrice()<<endl;
    cout<<endl;
    cout<<" Do you wish to enter any more products?"<<endl;
    cout<<endl;
    cout<< "Enter 'Y' or 'N'"<<endl;
    cin>> ContinuationFlag;
    }
    return 0;
    }



I keep getting an error code of term does not evaluate to a function taking 0 arguments. Can anyone help?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>