Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help forming this narrative document based on my C++ code please. //Header File #ifndef PROJECT1_H #define PROJECT1_H #include #include using namespace std; class
I need help forming this narrative document based on my C++ code please.
//Header File
#ifndef PROJECT1_H
#define PROJECT1_H
#include
#include
using namespace std;
class inventory
{
public:
inventory();
inventory( int, char[], int, double, double, int);
int GetInventoryId() const;
char* GetInventoryDescription() const;
int GetManId() const;
double GetWholePrice() const;
double GetMarkup() const;
int GetQuantity() const;
//Display info of products
void Display() const;
private:
int InventoryId;
mutable char InventoryDescription[30];
int ManId;
double WholePrice;
double Markup;
int Quantity;
};
#endif
//Implementation File
#include "Project1.h"
//constructors
inventory::inventory()
{
InventoryId = 0;
InventoryDescription[29] = '';
ManId = 0;
WholePrice = 0;
Markup = 0;
Quantity = 0;
}
inventory::inventory( int InitInventoryId, char InitInventoryDescription[], int InitManId, double InitWholePrice,
double InitMarkup, int InitQuantity)
{
InventoryId = InitInventoryId;
strcpy_s( InventoryDescription, InitInventoryDescription );
ManId = InitManId;
WholePrice = InitWholePrice;
Markup = InitMarkup;
Quantity = InitQuantity;
}
//return value of private members
int inventory::GetInventoryId() const
{
return(InventoryId);
}
int inventory::GetManId() const
{
return (ManId);
}
char* inventory::GetInventoryDescription() const
{
return (InventoryDescription);
}
double inventory::GetWholePrice() const
{
return (WholePrice);
}
double inventory::GetMarkup() const
{
return (Markup);
}
int inventory::GetQuantity() const
{
return (Quantity);
}
//display info from inventory
void inventory::Display() const
{
char Seperator[50] ="-------------------------------------------------";
cout
//display info from inventory
cout
cout
cout
cout
cout
cout
cout
cout
cout
}
//Client Code
#include "Project1.h"
int main()
{
int InitInventoryId = 0;
char InitInventoryDescription[30] = "";
int InitManId = 0;
double InitWholePrice = 0;
double InitMarkup = 0;
int InitQuantity = 0;
char NextChar = '';
char ContinuationFlag = 'Y';
while (toupper(ContinuationFlag) == 'Y')
{
//display data for inventory products
cout
cout
cin>>InitInventoryId;
cout
cin>>InitManId;
cout
cin>>InitWholePrice;
cout
cin>>InitMarkup;
cout
NextChar = cin.peek( );
if(NextChar == ' ')
{
cin.ignore();
}
cin.get(InitInventoryDescription, 29);
cout
cin>>InitQuantity;
//create inventory object
inventory inventoryItem( InitInventoryId, InitInventoryDescription, InitManId, InitMarkup, InitWholePrice, InitQuantity);
inventoryItem.Display();
cout
Function: Provide a brief description of the purpose of the program, including a "User Manual" for the progranm Methodology: Headers Used List the files included enables the program to accomplish. For example: in the program along with a brief description of what each file string.h iomanip.h Used for screen input and output functions Used for string manipulation functions Used for output formatting Enumerated Variables: List the any enumerated variables used in the program. Global Constants and Variables: List the global constants and/or variables used in the program along with a brief description of what each constant or variable represents. For example: Product FirstRecordPointer Represents head of the linked list of "Product" class objects Class Data Members and Member Functions: List the private data members used in the class alonwith a brief description of each variable represents. For example Private char ProductDescriptio75] Represents the description of the product in inventory List the public member functions created for the class along with a brief description of what each function accomplishes. For example Public Product) Default constructor for the "Product" class Functions and Their Descriptions: Detail each function created for the program, regardless of whether the function is called within the program. Each function should include the following details: Name Of Function Function: Brief description of what the function accomplishes List: Listing ofncoming arguments Local Variable(s): Listing of all variables declared within the function, along with a brief description of what each variable represents Process: Details of the procedures, methods and techniques that were utilized to accomplish the assigned task Return Value Data type returned by the function Child Function(s): Additional functions called by the function For example, consider the following function: Return Value Argument(s) int oSystem::CountItems) oSystem* CurrentRecordPointer: LLocal int ItemCounter 0; Variables orCurrentRecordPointer-FirstRecordPointer Child Function CurrentRecordPointer NULL CurrentRecordPointer= CurrentRecordPointer-XetLink( ) ) ItemCounter++ return( ItemCounter) CountItems Function: Argument List: Local Variables Count the number of items stored in the linked list None OSystem CurrentRecordPointer Pointer used to traverse the linked list int ItemCounter Integer used to hold number of items in the the linked list Process: The pointer, CurentRecordPointer, is set to the value of the FirstRecordPointer. Using a for" loop, the linked list is traversed until the end of the list is encountered (determined by NULL" in the "link" variable of a node). As each node is encountered, an integer is incremented. Return Value: integer (ItemCounter) Child Function(s): GetLink cout
cin>>ContinuationFlag;
}
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started