Question

You are to write a program to produce an inventory report for a local company. Your...

You are to write a program to produce an inventory report for a local company. Your input will be item name, item number, quantity, price per item, safe stock value. The following shows which columns the input will be in:

item name             item number         quantity                  price                      safe stock

20 chars                 5 char                     3 char                      6 chars                 3 chars

Output will be as follows:

item number         item name    quantity   price     price*quantity   %ofStock    flag

You will place a symbol in the flag field if the inventory quantity is less than the safe stock value.

This tells the company that they are getting too low on this item and need to build up the inventory stock.

Output:

  1.        Print the report in sorted ordered, sorted on item number.

                  For each item, indicate the total value of the stock and the percentage of this item to the total     stock’s value.

  1.       Indicate the percentage of total inventory value to the total value of the highest single item in inventory. Print the item and its information. (Print this at the end of the table. )

  1.     Indicate the percentage of total inventory value to the total value of the three least valued items combined. Print the three items and their information, again at the end of the table. ( I just need to see how much of the companies monies are tied up some of the lesser inventory.)

Restrictions:

You must use a link list for the inventory (no array). C++ Language

Data to read in called invt.txt:

Wong Batts 98723 243 6.45 200
Widgets No Two 83209 970 17.50 800
HumpBack Whale Songs 74329 42 23.70 50
Frozen Ice Cubes 73922 100 0.15 250
Plastic Ice Cubes 10044 450 0.60 540
Canned Solar Winds 23923 12 550.00 5
Sented Toe Jamm 18492 14 0.50 20
UnSented Toe Jam 18499 23 .74 20
Backwards Left Turns 87293 5 34.95 12
El Slick Slider 38324 15 225.00 18
Meals for Up Chuck 62042 20 16.50 24
Super House Cleaner 71083 14 69.85 18
Stars Dancing Shoes 23934 80 22.50 75
LowRider Briches 98744 138 45.95 125
HighRider Shoes 12283 372 35.95 400
Colored Pie Charts 51121 60 1.50 30
LensLess Saftey Glas 44433 22 2.10 35
Used Boat Anchors 73277 6 17.50 7

0 0
Add a comment Improve this question Transcribed image text
Answer #1

OUTPUT:

CODE TO COPY:

#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <sstream>
using namespace std;
struct InventoryRecord
{
string name;   
int qty;
double cost;
};
const int MAX_SIZE = 9;
void addData(InventoryRecord list[], int& size);
void dispData(const InventoryRecord list[], int size);
void saveFile(const InventoryRecord list[], int size);
void openFile(InventoryRecord list[], int& size);
char getMenuResponse();
int main(int argc, char *argv[])
{
InventoryRecord recList[MAX_SIZE];
int numOfRecs = 0;
bool run = true;
do
{
cout << "Inventory Program - " << numOfRecs << " items in stock" << endl;
switch ( getMenuResponse() )
{
case 'A': addData(recList, numOfRecs); break;
case 'D': dispData(recList, numOfRecs); break;
case 'O': openFile(recList, numOfRecs); break;
case 'S': saveFile(recList, numOfRecs); break;
case 'Q': run = false; break;
default : cout << "That is NOT a valid choice" << endl;
}
}
while (run);
cout << endl << "Program Terminated" << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
void addData(InventoryRecord list[], int& size)
{
InventoryRecord tmp;
char str[256];
if (size < MAX_SIZE)
{
system("cls");
cout << "Enter Inventory Records" << endl << endl;
cout << "Name: ";
cin.getline(str, 256, '\n');
tmp.name = str;
cout << "Quantity: ";
cin >> tmp.qty;
cout << "Cost: ";
cin >> tmp.cost;
cout << endl;
cout << "Add the record to inventory? (y/n) ";
cin >> response;
if (toupper(response) == 'Y')
list[size++] = tmp;
}
else
{
cout << "Inventory at full; cannot enter more unit." << endl;
system("pause");
}
system("cls");
}
void dispData(const InventoryRecord list[], int size)
{
system("cls");
double cost = 0;
if(size < 1)
{
cout << "Nothing to display" << endl;
}
else
{
cout << "All Inventory item has been shown" << endl << endl;
cout << fixed << setprecision(2);
cout << "Item Name Qty Cost" << endl;
cout << "~~~~~~~~~~~~~~~~~~" << endl;
cout << left;   
for (int i = 0; i < size; i++)
{
cout << setw(21) << list[i].name << right
<< setw(4) << list[i].qty
<< setw(10) << list[i].cost << left << endl;
cost = cost + list[i].cost * list[i].qty;
}
  
cout << "~~~~~~~~~~~~~~~~~~~" << endl;
cout << right << setw(3) << size;
cout << " items listed";
cout << right << setw(19) << cost << endl << endl;
}

system("PAUSE");
system("cls");
}
void saveFile(const InventoryRecord list[], int size)
{
ofstream outfi("Inventory.txt");
if (!outfi.fail())
{
system("cls");
cout << "Saving inventory to the disc ";
for(int i = 0; i < size; i++)
{
outfi << list[i].name << ';'
<< list[i].qty << ';'
<< list[i].cost;
if (i < size-1) outfi << endl;
}
cout << endl << size << " records writen to the disc." << endl;
outfi.close();
system("PAUSE");
system("cls");
}
else
{
cout << "ERROR: problem with file" << endl;
system("PAUSE");
system("cls");
}
}
void openFile(InventoryRecord list[], int& size)
{
ifstream infi("Inventory.txt");
string str;
stringstream strstrm;
if (!infi.fail()) {
system("cls");
cout << "Reading inventory from the disc ";
size = 0;
while(!infi.eof() && size < MAX_SIZE)
{
getline(infi, str, ';');
list[size].name = str;
getline(infi, str, ';');
strstrm.str(""); strstrm.clear();
strstrm << str;
strstrm >> list[size].qty;
getline(infi, str);
strstrm.str(""); strstrm.clear();
strstrm << str;
strstrm >> list[size++].cost;
}
cout << endl << size << " records read from the disc." << endl;
system("PAUSE");
system("cls");
}
else
{
cout << "ERROR: problem with file" << endl;
system("PAUSE");
system("cls");
}
}
char getMenuResponse()
{
char response;
cout << endl << "Make your selection" << endl
<< "(A)dd Record, (D)isplay Records, (O)pen File, (S)ave File, (Q)uit" << endl
<< "> ";
cin >> response;
cin.ignore(256, '\n');
}

Add a comment
Know the answer?
Add Answer to:
You are to write a program to produce an inventory report for a local company. Your...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program to keep track of the inventory of grocery store. Write a test program...

    Write a program to keep track of the inventory of grocery store. Write a test program that prompts the user to enter how many items of inventory the store has. After that enter item name, quantity and price of each item in three different arrays called Itemname, Quantity and Price. Than calculate the Total=Quantity*Price of items in store and FinalTotal of all the items and print in following exact format using array: Sample run of program: Enter number of items...

  • 20 points Use your inventory spreadsheet from assignment 1 Add a column (if you don't have...

    20 points Use your inventory spreadsheet from assignment 1 Add a column (if you don't have one yet) that gives a product number/inventory ID to each item Make sure you have the following column headings 1. 2. a. Inventory ID b. Product Name Unit price C. d. Quantity in Stock e. Inventory Value (Unit price Quantity) Reorder Level f. g. Quantity to Order 3. Use a formula to calculate Inventory Value 4. Use a formula to calculate total inventory Use...

  • C++ program, item.cpp implementation. Implementation: You are supposed to write three classes, called Item, Node and In...

    C++ program, item.cpp implementation. Implementation: You are supposed to write three classes, called Item, Node and Inventory respectively Item is a plain data class with item id, name, price and quantity information accompanied by getters and setters Node is a plain linked list node class with Item pointer and next pointer (with getters/setters) Inventory is an inventory database class that provides basic linked list operations, delete load from file / formatted print functionalities. The majority of implementation will be done...

  • IN PYTHON You are building a program for a Point of Sale (POS) machine for a...

    IN PYTHON You are building a program for a Point of Sale (POS) machine for a fruit store. The inventory and price list are stored in a file (i.e. items.txt) with an example as follows: banana 3 1.25 apple 6 1.75 orange 32 0.5 pear 55 2.5 For illustration, the first line implies that "There are 3 bananas in the inventory and the price of a banana is $1.25" You have to write four functions: 1. The first function readstockprice...

  • Write a C program that takes inventory data from a file and loads a structure of up to 100 items ...

    Write a C program that takes inventory data from a file and loads a structure of up to 100 items defined as: struct item { int item_number; char item_name[20]; char item_desc[30]; float item_price; } I called mine: struct item inventory[100]; (you may use any name you wish) I will let you decide the appropriate prompts and edit messages. You will read the data from the data file and store the info in an array. Assume no more than 100 records...

  • Zybooks 11.12 LAB*: Program: Online shopping cart (continued) Python 3 is the code needed and this...

    Zybooks 11.12 LAB*: Program: Online shopping cart (continued) Python 3 is the code needed and this is in Zybooks Existing Code # Type code for classes here class ItemToPurchase: def __init__(self, item_name="none", item_price=0, item_quantity=0): self.item_name = item_name self.item_price = item_price self.item_quantity = item_quantity # def __mul__(self): # print_item_cost = (self.item_quantity * self.item_price) # return '{} {} @ ${} = ${}' .format(self_item_name, self.item_quantity, self.item_price, print_item_cost) def print_item_cost(self): self.print_cost = (self.item_quantity * self.item_price) print(('{} {} @ ${} = ${}') .format(self.item_name, self.item_quantity, self.item_price,...

  • Q1. Write program calculate the final price of a purchased item using values entered by the...

    Q1. Write program calculate the final price of a purchased item using values entered by the user Hint: you are required to use formatting output for number, currency and percentage. --------------------[Print Receipt] ------------ Enter the quantity: 6 Enter the unit price: $1.98 Subtotals: $10.14 Tax: $ 0.61 at 6% Total: $10.75 ------------------------------------------------ Q2. Write a program that prompts for and reads the users’ first name and last name, Job title, DOB (date of Birth), and the Email address (separately). Then...

  • In C++ Programming Write a program in Restaurant.cpp to help a local restaurant automate its breakfast...

    In C++ Programming Write a program in Restaurant.cpp to help a local restaurant automate its breakfast billing system. The program should do the following: Show the customer the different breakfast items offered by the restaurant. Allow the customer to select more than one item from the menu. Calculate and print the bill. Assume that the restaurant offers the following breakfast items (the price of each item is shown to the right of the item): Name Price Egg (cooked to order)...

  • C++ program, inventory.cpp implementation Mostly need the int load(istream&) function. Implementation: You are supp...

    C++ program, inventory.cpp implementation Mostly need the int load(istream&) function. Implementation: You are supposed to write three classes, called Item, Node and Inventory respectively Item is a plain data class with item id, name, price and quantity information accompanied by getters and setters Node is a plain linked list node class with Item pointer and next pointer (with getters/setters) Inventory is an inventory database class that provides basic linked list operations, delete load from file / formatted print functionalities. The...

  • In this project you will write a C++ program that simulates the purchase of a single...

    In this project you will write a C++ program that simulates the purchase of a single item in an online store. What to do Write a C++ program that: 1. Prints out a welcome message. 2. Prompts the user for the following information: (a) Their first name (example: Roger) (b) Their last name (example: Waters) (c) The name of the product (example: Brick) (d) The unit price of the product (example: 1.99) (e) The quantity to buy (example: 200) (f)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT