I am getting two compile errors and needing help. Please see the description of the program below. And below that is the code for the said program.
Thanks,
Task is to create a pram that manages a simple inventory for a retail store.
Program Input
The input to the program will be the product id number (a 5-digit id number), the manufacturer’s id number (a 4 digit id number), the wholesale price of the product, the mark-up percentage for the product, the description of the product , and the quantity of product in stock.
Output
Prepare a listing of the inventory for the store with appropriate column headings. This listing should include the following:
the product id number;
the product description;
the manufacturer’s id number;
the wholesale price of the product;
the mark-up percentage for the product;
the quantity of product in inventory;
The retail price for the product (the wholesale price increased by the mark-up percentage) should be printed as a separate item from the above listing.
Processing
1). The class variables, which represent a single product sold by the store, should include the following data members:
the product id number integer;
the product description character array;
the manufacturer’s id number integer;
the wholesale price of the product double;
the mark-up percentage for the product double;
the quantity of product in inventory integer;
2). The class should have the following member functions:
a). Two constructors.
The first is the default, which sets all the members of the class to zero.
The second constructor should enable the user to specify all of the initial attributes of the members of the class.
b). Separate functions which return the values of the members of the class.
c). A function that displays the values of the members of the class to the monitor (as described in the “output” section).
d). A function that returns the class object’s retail price (the wholesale price increased by the mark-up percentage).
#include <iostream>
#include <iomanip>
#include "InventoryItem.h"
using namespace std;
const int MAX_INVENTORY = 255;
void DisplayInventory (InventoryItem inv[], int total);
void DisplayInventoryItem (InventoryItem item);
int main ( )
{//begin int main brackets
InventoryItem Inventory [MAX_INVENTORY];
cout << "How many items would you like to enter? ";
int x = 0;
cin >> x;
for (int i=0; i<x; i++)
{//begin for loop bracket
int ProductIdNumber = 0;
int ManufacIdNumber = 0;
int Quantity = 0;
double WholesalePrice = 0;
double MarkUpPercentage = 0;
char ProductDescription [255];
cout << "Please enter data for item " << (i+1) << " " << endl;
cout << "Product Id: " ;
cin >> ProductIdNumber;
int InventoryItem::getQuantity() const
{
return Quantity;
}
#ifndef INVENTORYITEM_H
#define INVENTORYITEM_H
class InventoryItem //declares class StoreInventory
{ //begins class brackets
public: //declaring public member functions
//constructors declared
InventoryItem ( ); //Default constructor setting members of the class to zero
InventoryItem (int ProductIdNumber, int ManufacIdNumber, int Quantity, double WholesalePrice, double MarkUpPercentage, const char* ProductDescription); //Constructor that enables the user to specify all of the initial attributes of the members of the class
//returning values of private datamembers
int getProductIdNumber ( ) const; //returning an int which is the product id
int getManuFacIdNumber ( )const; //returning an int which is the manufacturer's id number
int getQuantity ( )const; //returning an int which is the quantity of the product
double getWholesalePrice ( )const; //returning a double which is the wholesale of the product
double getMarkUpPercentage ( )const; //returning a double which is the mark up percentage
double getRetailValue ( ) const; //returning a double that is the mark up price
const char* getProductDescription ( )const; //returning a string which is the product's description
//displays the values of the members of the class to the monitor
void DisplayInventoryItem ( ) const; //function that displays the store inventory
void setDataInventory (int InIdNumber, int InManufacIdNumber, int InQuantity, double InWholesale, double InMarkup, const char* InDescription); //function that sets the data
private: //declaring private data members
// Data members declared
int ProductIdNumber; //An array of integers for storing the product id number
int ManufacIdNumber; //An array of integers for storing the manufacturer's id number of a product
int Quantity; //An array of integers for storing the quantity of a product
double WholesalePrice; //An array of doubles for storing the wholesale price of a product
double MarkUpPercentage; //An array of doubles for storing the mark up percentage
mutable char ProductDescription [255]; //An array of strings for storing the product's description with a max inventory size and max string size
Wow, wall of text!
Use code braces around code (the <> symbol in the format section, or type code and /code with square braces around it) to make code more readable for the rest of us.
As it is, I took the effort to read through all this, and found one mistake.
You declared DisplayInventory at the top of your main.cpp file, but forgotten to define it, so when it's called at the end of int main(), the compiler doesn't know what to do.
If you want help beyond that, it would be better to use code tags so we can read your code better.