Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Implement a transaction-based linked list data structure using a C++ object. The program will be interactive. A transaction will be entered at the command

1. Implement a transaction-based linked list data structure using a C++ object. The program will be interactive. A transaction will be entered at the command line after a short prompt and output will be displayed on the console display. Note: a batch of input transactions in a file can be processed using redirection. 2. A linked list of inventory part IDs and quantities will be created, updated and managed using Add, Remove and List transactions. Any non-blank part ID is valid. The quantity must be in the range from -100 to 100. Transaction types will be processed as follows: • Add – To add a part number and/or quantity to the linked list, enter a transaction in the form of “A”, space, part ID, space, quantity. For example: “A battery 25”. If the new part ID is not on the list and the new quantity is not greater than 100, the part ID and quantity will be added to the list. If the part ID is on the list, the quantity on the transaction will be added to the quantity in the list if the total quantity is not greater than 100. One of two messages will be displayed: (1) “transaction processed” or (2) “transaction not processed due to excessive quantity”. • Remove – To remove quantity from the inventory in the list, enter a transaction in the form of “R”, space, part ID, space, quantity. For example: “R w-123 14”. If the part ID is on the list, the quantity on the transaction will be subtracted from the quantity in the list if the total quantity is not less than -100. If the part ID is not on the list, the transaction cannot be processed. One of three messages will be displayed: (1) “transaction processed”, (2) “transaction not processed due to invalid part ID” or (3) “transaction not processed due to excessive backorder”. • List – To display the part IDs and quantities in a numbered list, enter a transaction in the form of “L”. Each part ID in the list will be displayed next to a sequential number and the respective quantity on a line by itself. • Quit – To terminate the program, enter a transaction in the form of “Q”. In this assignment, use the partially completed class called partList.h. You are to complete the methods add, exists and remove. 3. Here is sample dialogue of the running program:

$ prog2 enter transaction: A apple 30 transaction processed. enter transaction: A apple 50 transaction processed. enter transaction: A apple 40 transaction not processed due to excessive quantity. enter transaction: A B-9 20 transaction processed. enter transaction: L 1. apple 80 2. B-9 20 enter transaction: R apple 95 transaction processed. enter transaction: L 1. apple -15 2. B-9 20 enter transaction: Q $ A sample file of transactions, such as prog2.dat, may contain the following: A apple 30 A apple 50 A apple 40 A B-9 20 L R apple 95 L Q Using redirection, the program will be run as follows: $ prog2 < prog2.dat The output produced will be similar to the output shown above with redirection.

Please upload the C++ program source file (i.e., cpp file) and modified partList header file as separate attachments.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Answer Below is the implementation of the transactionbased linked list data structure in C This program reads transactions from the user or a file pro... 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

Operations management in the supply chain decisions and cases

Authors: Roger G Schroeder, M. Johnny Rungtusanatham, Susan Meyer Goldstein

7th edition

77835433, 978-0077835439

More Books

Students also viewed these Programming questions

Question

benefits of using SaaS cloud based solution

Answered: 1 week ago

Question

When should you avoid using exhaust brake select all that apply

Answered: 1 week ago