Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

TITLE EVALUATING AN INVENTORY USING A LINKED LIST INTRODUCTION We have recently described pointers in C++ and how to use them to build linked data

TITLE

EVALUATING AN INVENTORY USING A LINKED LIST

INTRODUCTION

We have recently described pointers in C++ and how to use them to build linked data structures such as linked lists. We have also described variations of the basic linked list, including lists with header and trailer nodes. This project uses a linked list with a header and a trailer to hold the data in an inventory processing task.

DESCRIPTION

A data file describes the inventory in a warehouse. Each line of the file describes one item in the inventory: its stock number, name, unit price, and quantity on hand. You are to design and write a program that reads such a file and saves the information in a linked list in which each node holds one item's information. The list will also have a header node and a trailer node; these simplify the insert() and remove() functions, and slightly complicate others.

The items are ordered in this list by their stock numbers. The program computes the value of each kind of item and the total value of the inventory, and writes to the terminal both the [ordered] inventory list, with the values, and the total value.

INPUT

Each line of an input file holds information about one item in the warehouse's inventory: its stock number, its name, its unit price, and the quantity of the item on hand. There will be no embedded blanks in the item's name, and no name will be longer than 16 characters. The input file will contain information about at least one item. You may arrange the contents of input files so that they are easy for the program to read.

OUTPUT

The program directs its output to the terminal. That output will consist of the inventory list with the value of each kind of item, sorted into ascending order by stock numbers, and the total value of the inventory, appropriately labeled.

ERRORS

The program may assume that the input is as described; it need not detect any errors.

EXAMPLE

For example, if an input file inventory.dat looks like this:

 836472 widget 15.45 125 773643 wrench 8.25 77 837723 large_clamp 10.77 66 162253 sprocket 5.50 143 526833 small_clamp 8.52 80 235547 power_drill 42.38 25 635521 hand_saw 15.33 43 

then a run of the program might look like this:

 Inventory processing. Enter input file name: inventory.dat Number Name Unit Price Quantity Value -------------------------------------------------------- 162253 sprocket 5.50 143 786.50 235547 power_drill 42.38 25 1059.50 526833 small_clamp 8.52 80 681.60 635521 hand_saw 15.33 43 659.19 773643 wrench 8.25 77 635.25 836472 widget 15.45 125 1931.25 837723 large_clamp 10.77 66 710.82 -------------------------------------------------------- Total value of inventory = $6464.11 

OTHER REQUIREMENTS

Write a class that provides the necessary inventory list functions. Call class functions from the client program to process the inventory. File interactions should occur only in the client program.

Create your own data files; do not copy the one above.

HINTS

A node in the list will have fields for the item information and a pointer field. It is not necessary to count the number of items represented in the input file.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions