//Specification File #ifndef INVENTORY_H #define INVENTORY_H #include <iostream>
ID: 3638323 • Letter: #
Question
//Specification File#ifndef INVENTORY_H
#define INVENTORY_H
#include <iostream>
#include <iomanip>
using namespace std;
class Inventory
{
public:
//Constructors
Inventory( );
Inventory( int, char[], int, double, double, int );
//Return the value of the private members
int GetProductNumber( ) const;
char* GetProductType( ) const;
int GetManufactureNumber( ) const;
double GetWholesalePrice( ) const;
double GetMarkupPercent( ) const;
int GetQuantity( ) const;
double GetRetailCalc( ) const;
//Retail goes here**************************
//Display information concerning Inventory
void Display( ) const;
private:
int ProductNumber;
char ProductType;
int ManufactureNumber;
double WholesalePrice;
double MarkupPercent;
int Quantity;
//Modify or mutable
mutable char ProductType[25];
};
#endif
//Specification File
#ifndef INVENTORY_H
#define INVENTORY_H
#include <iostream>
#include <iomanip>
using namespace std;
class Inventory
{
public:
//Constructors
Inventory( );
Inventory( int, char[], int, double, double, int );
//Return the value of the private members
int GetProductNumber( ) const;
char* GetProductType( ) const;
int GetManufactureNumber( ) const;
double GetWholesalePrice( ) const;
double GetMarkupPercent( ) const;
int GetQuantity( ) const;
double GetRetailCalc( ) const;
//Retail goes here**************************
//Display information concerning Inventory
void Display( ) const;
private:
int ProductNumber;
char ProductType;
int ManufactureNumber;
double WholesalePrice;
double MarkupPercent;
int Quantity;
//Modify or mutable
mutable char ProductType[25];
};
#endif
//Inventory Class Testing File (Inventory Class Client Code)
#include "Inventory.h"
int main()
{
int InitProductNumber = 0;
char InitProductType[25] = "";
int InitManufactureNumber = 0;
double InitWholesalePrice = 0;
double InitMarkupPercent = 0;
int InitQuantity = 0;
double InitRetailCalc = 0;
//The "ContinuationFlag" is used for looping
char NextChar = '';
char ContinuationFlag = 'Y';
//The "Toupper" function returns the uppercase value
//of the argument passed
while (toupper(ContinuationFlag) == 'Y' )
{
cout << endl;
cout << "Enter The Product's Identification Number: " << endl;
cin >> InitProductNumber;
cout << "Enter The Product's Manufacturer's"
"Identification Number: " << endl;
cin >> InitManufactureNumber;
cout << "Enter The Product's Wholesale Price: " << endl;
cin >> InitWholesalePrice;
cout << "Enter The Product's Mark-up Percentage: " << endl;
cin >> InitMarkupPercent;
cout << "Enter The Product's Description: " << endl;
cin >> InitProductType;
cout << "Enter The Quantity Of The Product In Stock: " << endl;
cin >> InitQuantity;
//The "peek" function returns the next character without
//extracting it from the input stream
NextChar = cin.peek( );
//If the next character is a " " (the carriage return
//character), then the "ignore" function is called. The
//"ignore" function, without input arguments, will
//cause the next character to be skipped
if ( NextChar == ' ' )
{
cin.ignore( );
}
cin.get( InitProductType, 25 );
//Create Inventory Object
Inventory( InitProductNumber, InitProductType, InitManufactureNumber,
InitWholesalePrice, InitMarkupPercent, InitQuantity );
//Display Information concerning Inventory
cout << endl;
cout << "Office Supply Product Retail Price: " << endl;
cout << "Do you wish to enter any more products? " << endl;
cout << "Enter 'Y' or 'N'" << endl;
cin >> ContinuationFlag;
}
return 0;
}
******************************************
1>------ Build started: Project: Program_1, Configuration: Debug Win32 ------
1>Compiling...
1>ClientCode.cpp
1>c:users inadocumentsisual studio 2008projectsprogram_1program_1inventory.h(38) : error C2040: 'Inventory::ProductType' : 'char [25]' differs in levels of indirection from 'char'
1>Implementation.cpp
1>c:users inadocumentsisual studio 2008projectsprogram_1program_1inventory.h(38) : error C2040: 'Inventory::ProductType' : 'char [25]' differs in levels of indirection from 'char'
1>Generating Code...
1>Build log was saved at "file://c:UsersTinaDocumentsVisual Studio 2008ProjectsProgram_1Program_1DebugBuildLog.htm"
1>Program_1 - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Explanation / Answer
Try string instead of char[25].
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.