You are on page 1of 12

Ricardo Lizama – Program Assignment 1 1

Structure Chart

main

Store Display

GetIdProduct

GetDescription

GetIdManu

GetPrice

GetMarkUp

GetQuantity

GetNewPrice

System: Retail Inventory System


Program: Store.exe
Programmer: Ricardo Lizama
Date: 02/02/2016
Chart Number: Structure Chart No. 1
Comments: Store Class Member
Function Noted
Ricardo Lizama – Program Assignment 1 2

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.

Global Constants and Variables:

I did not use any global constant or variable

Class Data Members and Member Functions:

Private:

Int Id_product Represents the identification number of the product

Int id_manu Represents the identification number of the manufacturer.

Int Quantity Represents the quantity of units on hand

Double Price Represents the wholesale price of the product.

Double markup Represents the mark-up percentage of the product.

Char Description[24] Represents a description of the product in inventory.

Public:

Store() Default constructor for the Store class

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

Functions and Their Descriptions


Store::Store()

It initializes and sets all variables to zero

It takes no arguments

Local variables:

Id_manu Identification number of the manufacturer

Id_product Identification number of the product

Price Wholesale price of the product

Markup Mark-up price to be applied to the wholesale price

Description[24] Description of the product

Quantity Qunatity on hand.

Process:

Every variable is set equal to zero.

Return Value:

None

Store::Store(int initId_manu, int initid_product, double initPrice, double initMarkUp, char


initDescription[], int initQuantity)

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

Int Store::GetIdManu() const

Function: Constant function that is used to get the ID of the manufacturer.

Argument List: None

Process: return the value stored in the variable Id_manu

Return value: Id_manu which is an integer

Int Store::GetIdProduct() const

Function: Constant function that is used to get the ID of the product.

Argument List: None

Process: return the value stored in the variable Id_Product

Return value: Id_Product which is an integer

doublle Store::GetPrice() const

Function: Constant function that is used to get the price of the product.

Argument List: None

Process: return the value stored in the variable Price

Return value: Price, which is a double.

double Store::GetMarkUp() const

Function: Constant function that is used to get the mark-up percentage of the product.

Argument List: None

Process: return the value stored in the variable Markup

Return value: Markup which is an double

Char* Store::GetDescription() const

Function: Constant function that is used to get the description of the product.

Argument List: None


Ricardo Lizama – Program Assignment 1 8

Process: return the value stored in the variable Description

Return value: Description, which is a character

Int Store::GetQuantity() const

Function: Constant function that is used to get the quantity available on hand of the
product.

Argument List: None

Process: return the value stored in the variable Quantity

Return value: Quantity, which is an integer

double Store::GetNewPrice() const

Function: Constant function that is used to get the new price of the product after adding the
markup percentage.

Argument List: None

Process: It will return a multiplication of the value stored in the variable “Price” time one
plus the mark-up percentage.

Return value: (Price*(1+Markup)).

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.

Additional function called by this function: GetIdmanu(), GetIdProduct(), GetMarkup(),


GetPrice(), GetDescription(), GetNewPrice(), GetQuantity().
Ricardo Lizama – Program Assignment 1 9

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;
}

Store::Store(int initId_manu, int initid_product, double initPrice, double initMarkUp,


char initDescription[], int initQuantity)
{
Id_manu= initId_manu;
Id_product = initid_product;
Price = initPrice;
Markup= initMarkUp;
strcpy_s(Description, initDescription);
Ricardo Lizama – Program Assignment 1 10

Quantity = initQuantity;

int Store::GetIdManu() const


{
return(Id_manu);
}

int Store::GetIdProduct() const


{
return(Id_product);
}

double Store::GetPrice() const


{
return(Price);
}

double Store::GetMarkUp() const


{
return(Markup);
}

char* Store::GetDescription() const


{
return (Description);
}

int Store::GetQuantity() const


{
return(Quantity);
}
double Store::GetNewPrice() const
{
return(Price*(1+Markup));
}

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

cout<<right<<setw(shortwidth)<<setfill(space)<<"| Mark-Up Percentage:


"<<GetMarkUp()<<endl;
cout<<right<<setw(shortwidth)<<setfill(space)<<"| Quantity in Stock:
"<<GetQuantity()<<endl;
cout<<Separator<<endl<<Separator<<endl;

cout<< "Office Supply Retail Price:


$"<<fixed<<showpoint<<setprecision(2)
<<setw(12)<<setfill(' ')
<< " $ "<<GetNewPrice()<<endl;
}

“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;

Store NewItem(initid_product, initId_manu, initPrice, initMarkUp,


initDescription, initQuantity);
NewItem.Display();
cout<<endl
<<"Do you wish to enter any more goldfish into inventory?"
<<endl;
cout<<"Enter 'Y' or 'N'"<<endl;

cin>>ContinuationFlag;
}

return 0;
Ricardo Lizama – Program Assignment 1 12

Final Result

You might also like