Professional Documents
Culture Documents
Structure Chart
main
Store Display
GetIdProduct
GetDescription
GetIdManu
GetPrice
GetMarkUp
GetQuantity
GetNewPrice
Narrative Outline
Function:
This is an inventory system that allows the user to enter the information of a product in a retail store.
The system will capture information about the product and calculate the retail price of the product.
User Manual
When you execute the Program, this screen will be the first one the user will see, and, here, the user will
need to type the 5-digit identification number of the product.
After the user enters the product’s identification number, the user will need to enter the 4-digit
identification number of the manufacturer.
Ricardo Lizama – Program Assignment 1 3
Then, the system will ask the user for the wholesale price of the producct. The price can include
decimals or it can be a whole number.
After the price is entered into the system, the user needs to type to mark-up percentage that will be
added to the wholesale price. The mark-up percentage must be entered in decimal forms.
Ricardo Lizama – Program Assignment 1 4
Then, a description of the product can be entered explaining what the product is.
Finally, the user needs to enter the quantity of the product on hand, and the system will do the
remaining where it calculates the retail price and shows the data in a table.
The user should see a screen like this with the information he/she entered. Besides that, the user will be
asked if the user wants to record another product.
Ricardo Lizama – Program Assignment 1 5
Methodology:
Specification.h This file is used to input the information required to record an entry in the
inventory system. The function to display or the information is also declared in this file.
Private:
Public:
Store(int, int, double, double, char[], int) Constructor that enables the user to specify all of
the initial attributes of the members of the class.
int GetIdProduct() const Constant function that will retrieve the ID of the product.
int GetIdManu() const Constant function that will retrieve the ID of the manufacturer
Ricardo Lizama – Program Assignment 1 6
double GetPrice() const Constant function that will retrieve the wholesale price of the
product
double GetMarkUp() const Constant function that will retrieve the mark-up percentage to
be applied to the wholesale price of the product
char* GetDescription() const Constant function that will retrieve the description of
the product
int GetQuantity() const Constant function that will retrieve the quantity of the product.
double GetNewPrice() const Constant function that will calculate the retail price
using the information from functions GetPrice() and GetMarkup().
void Display() This function will display the information in an organized manner
It takes no arguments
Local variables:
Process:
Return Value:
None
Function: This function will enable the user to assign values to each of the variables previously declared
in the class.
Ricardo Lizama – Program Assignment 1 7
Argument list: int initId_manu, int initid_product, double initPrice, double initMarkUp, char
initDescription[], int initQuantity
Process:
Each of the arguments is set equal to the variables used on the other constructor.
Return Value:
None
Function: Constant function that is used to get the price of the product.
Function: Constant function that is used to get the mark-up percentage of the product.
Function: Constant function that is used to get the description of the product.
Function: Constant function that is used to get the quantity available on hand of the
product.
Function: Constant function that is used to get the new price of the product after adding the
markup percentage.
Process: It will return a multiplication of the value stored in the variable “Price” time one
plus the mark-up percentage.
Void Store::Display()
Function: This function will display all of the information obtained in an organized manner
using in/out manipulators.
Arguments: None
Local Variables: char space, int shorthwidth, and char separator[50]. They are used to
facilitate the use of the in/out manipulators.
Process: This information take the information from all of the function described above to
display the information in an organized manner to the user.
Source Code
“Specification.h”
#ifndef STORE_H
#define STORE_H
#include <iostream>
#include <iomanip>
using namespace std;
class Store
{
public:
Store();
Store(int, int, double, double, char[], int);
int GetIdProduct() const;
int GetIdManu() const;
double GetPrice() const;
double GetMarkUp() const;
char* GetDescription() const;
int GetQuantity() const;
double GetNewPrice() const;
void Display();
private:
int Id_product, Id_manu, Quantity;
double Price, Markup;
mutable char Description[24];
};
#endif;
“Implementation.cpp”
#include "Specification.h"
Store::Store()
{
Id_manu = 0;
Id_product = 0;
Price = 0;
Markup = 0;
Description[24] = '\0';
Quantity = 0;
}
Quantity = initQuantity;
void Store::Display()
{
const char space = ' ';
const int shortwidth = 10;
char Separator[50] =
"|=============================================|";
cout<<endl<<Separator<<endl;
cout<<setw(36)<<setfill(' ')<<"| Office Supply Product Information
|"<<endl;
cout<<Separator<<endl<<endl;
cout<<right<<setw(shortwidth)<<setfill(space)<<"| Identification Number:
"<<GetIdProduct()<<endl;
cout<<right<<setw(shortwidth)<<setfill(space)<<"| Description:
"<<GetDescription()<<endl;
cout<<right<<setw(shortwidth)<<setfill(space)<<"| Manufacturer:
"<<GetIdManu()<<endl;
cout<<right<<setw(shortwidth)<<setfill(space)<<"| Wholesale Price:
$"<<GetPrice()<<endl;
Ricardo Lizama – Program Assignment 1 11
“MainCode.cpp”
#include "Specification.h"
int main()
{
int initId_manu = 0;
int initid_product = 0;
double initPrice = 0;
double initMarkUp = 0;
char initDescription[30] = "\0";
int initQuantity = 0;
char NextChar = '\0';
char ContinuationFlag = 'Y';
while (toupper(ContinuationFlag) =='Y')
{
cout<< "Enter the Product's Identification Number:"<<endl;
cin>>initid_product;
cout<< "Enter the Product's Manufacturer's Identification Number:"<<endl;
cin>>initId_manu;
cout<<"Enter the Priduct's Wholesale Price:"<<endl;
cin>>initPrice;
cout<<"Enter the Product's Mark-Up Price"<<endl;
cin>>initMarkUp;
cout<<"Enter the Product's Description: "<<endl;
NextChar = cin.peek();
if(NextChar=='\n')
{
cin.ignore();
}
cin.get(initDescription, 30);
cout<<"Enter the Quantity of the Product in Stock:"<<endl;
cin>>initQuantity;
cin>>ContinuationFlag;
}
return 0;
Ricardo Lizama – Program Assignment 1 12
Final Result