The application should display a dialog box requesting the user to enter the inf
ID: 3914588 • Letter: T
Question
The application should display a dialog box requesting the user to enter the information for a single product The following is an example of such a dialog box for a store which sells office supplies: Output Input Orchid Office Supply Company Inventory System Office Product Input Data Product ID Number 10001 Description Office Product Output Data Product ID Number 10001 cription 3.5" Floppy Disks Manufacturer's ID Number 5020 Retail Price Man ID Number 20 0 Wholesale Price 15 Mark-Up Percentage .2 Quantity In Stock 140 18.00 Quantity In Stock 140 Display Display Office Product Inventory Information Exit Exit Program Output 1?The application should display a listing of the data for a product in the store using appropriate labels and text boxes. This listing should include the following: a. the product id number b. the product description; c. the manufacturer's id number d. the retail price of the product (the wholesale price increased by the mark-up percentage); e. the quantity of product in inventory Page 134 -Explanation / Answer
main.cpp
#include "ItemInventory.h"
int main()
{
int inputID = 0;
int inputManuID;
char inputDescription[24] = "";
double inputPrice = 0;
double inputMarkUp = 0;
int inputCount = 0;
char NextChar = '';
char ContinuationFlag = 'Y';
while(toupper(ContinuationFlag) == 'Y')
{
// user input statements
cout << endl;
cout << "Enter The Product's Identification Number: " << endl;
cin >> inputID;
cout << "Enter The Product's Manufacturer's Identification Number: " << endl;
cin >> inputManuID;
cout << "Enter The Product's Wholesale Price: " << endl;
cin >> inputPrice;
cout << "Enter The Product's Mark-Up Percentage: " << endl;
cin >> inputMarkUp;
cout << "Enter The Product's Description: " << endl;
// ***************************************************
// * The "peek" function returns the next character *
// * without extracting it from the input stream *
// ***************************************************
NextChar = cin.peek();
if( NextChar == ' ' )
{
cin.ignore();
}
cin.get( inputDescription, 24 );
// Input Quantity statement
cout << "Enter The Quantity of the Product In Stock: " << endl;
cin >> inputCount;
// *******************************
// * Create InventoryItem Object *
// *******************************
ItemInventory InventoryItem( inputID, inputManuID ,inputDescription, inputPrice, inputMarkUp, inputCount);
//************************************************
//* Display Information Concerning ItemInventory *
//************************************************
InventoryItem.display();
cout << endl
<< "Do you wish to enter any more products"
<< endl;
cout << "Enter 'Y' or 'N' " << endl;
cin >> ContinuationFlag;
}
return 0;
}
ItemInventory.cpp
#include "ItemInventory.h"
// ItemInventory contructors
ItemInventory::ItemInventory()
{
IDnumber = 0;
manufacturerID = 0;
productD[24] = '';
price = 0;
markup = 0;
count = 0;
}
ItemInventory::ItemInventory( int IDnum, int manID , char charArray [] , double priceAssign , double markupVal , int itemCount )
{
IDnumber = IDnum;
manufacturerID = manID;
strcpy_s( productD, charArray );
price = priceAssign;
markup = markupVal;
count = itemCount;
}
// returns the product's identification number
int ItemInventory::getIDnumber() const
{
return IDnumber;
}
// returns the manufacturer's identification number
int ItemInventory::getManufacturerID() const
{
return manufacturerID;
}
// returns the product description
char* ItemInventory::getProductD() const
{
return productD;
}
// returns thhe wholesale price
double ItemInventory::getPrice() const
{
return price;
}
// returns the markup percentage
double ItemInventory::getMarkup() const
{
return markup;
}
// returns quantity of items
int ItemInventory::getCount() const
{
return count;
}
// displays values in a table
void ItemInventory::display() const
{
char Separator[57] = "========================================================";
char Divider[2] = "|";
//Displays Company title
cout << endl << Divider << Separator << Divider << endl;
cout << Divider << setw(45) << setfill(' ') << "Office Supply Product Information" << setw(12) << Divider << endl;
cout << Divider << Separator << Divider << endl;
cout << Divider << Separator << Divider << endl;
//Displays data of the item in inventory
cout << Divider << setw(30) << setfill(' ') << "Identification Number:" << setw(11) << getIDnumber() << setw(16) << Divider << endl;
cout << Divider << setw(21) << setfill(' ') << "Description: " << setw(32) << getProductD() << setw(4) << Divider << endl;
cout << Divider << setw(21) << setfill(' ') << "Manufacturer:" << setw(20) << getManufacturerID() << setw(16) << Divider << endl;
cout << Divider << setw(23) << setfill(' ') << "WholesalePrice:" << setw(19) << setprecision(2) << showpoint << fixed << getPrice() << setw(15) << Divider << endl;
cout << Divider << setw(27) << setfill(' ') << "Mark-Up Percentage:" << setw(14) << setprecision(2) << showpoint << fixed << getMarkup() << setw(16) << Divider << endl;
cout << Divider << setw(26) << setfill(' ') << "Quantity In Stock:" << setw(14) << getCount() << setw(17) << Divider << endl;
cout << Divider << Separator << Divider << endl;
cout << endl;
cout << "Office Supply Product Retail Price: $ " << setprecision(2) << showpoint << fixed << calculateMarkup() << endl << endl;
}
double ItemInventory::calculateMarkup() const //calculates the retail price
{
double retailPrice;
retailPrice = (price * markup) + price;
return retailPrice;
}
ItemInventory.h
#ifndef ITEMINVENTORY_H
#define ITEMINVENTORY_H
#include <iostream>
#include <iomanip>
using namespace std;
class ItemInventory
{
private:
int IDnumber; // Identification number
int manufacturerID; //manunfacturer's Identification number
mutable char productD[24]; // product description in a char array
double price; // wholesale price
double markup; //markup percentage
int count; // item quantity
public:
// ItemInventory contructors
ItemInventory();
ItemInventory( int , int , char [] , double, double , int );
// returns the product's identification number
int getIDnumber() const;
// return the manufacturer's identification number
int getManufacturerID() const;
// returns the product description
char* getProductD() const;
// returns the wholesale price
double getPrice() const;
// returns the markup percentage
double getMarkup() const;
// returns quantity of items
int getCount() const;
//displays values in a table
void display() const;
//calculates the retail price
double calculateMarkup() const;
};
#endif
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.