Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in C++ Inventory Program Write a program that uses a structure to store the following inventory information in a Binary file and access it using

in C++ Inventory Program Write a program that uses a structure to store the following inventory information in a Binary file and access it using Random Access Method: Item description Quantity on hand Wholesale cost Retail cost Date added to inventory The program should have a menu that allows the user to perform the following tasks: Add new records to the file Display any record in the file Change any record in the file For exact menu option text please see the test cases below:

For data file opening logic, you may use the code segment below: This segment tries to open an existing file, if the file does not exist, it creates new one. Please note that your data file name should be inventory,dat

fstream inventory; inventory.open("inventory.dat", ios::out|ios::in|ios::binary ); if (inventory.fail()) { inventory.open("inventory.dat", ios::out|ios::in | ios::binary| ios::trunc ); if (inventory.fail()) { cout << "Error opening file...."; return 0; } }

Test Cases:

Inventory Program Menu 1. ADD NEW Record 2. DISPLAY Record 3. MODIFY Record 4. EXIT Program please enter selection (1 - 4) : 1 Enter the NEW Record Data: Desciption: Coffee Quantity: 20 Wholesale Price: $10 Retail Price: $15 Date Added: 02022018 Inventory Program Menu 1. ADD NEW Record 2. DISPLAY Record 3. MODIFY Record 4. EXIT Program please enter selection (1 - 4) : 2 Which Record to DISPLAY: Please choose one of the following... 1 to 1 : 1 Description: Coffee Quantity: 20 Wholesale Price: $10.00 Retail Price: $15.00 Date: 02022018 Inventory Program Menu 1. ADD NEW Record 2. DISPLAY Record 3. MODIFY Record 4. EXIT Program please enter selection (1 - 4) : 1 Enter the NEW Record Data: Desciption: TEa Quantity: 30 Wholesale Price: $30 Retail Price: $40 Date Added: 03032018 Inventory Program Menu 1. ADD NEW Record 2. DISPLAY Record 3. MODIFY Record 4. EXIT Program please enter selection (1 - 4) : 2 Which Record to DISPLAY: Please choose one of the following... 1 to 2 : 2 Description: TEa Quantity: 30 Wholesale Price: $30.00 Retail Price: $40.00 Date: 03032018 Inventory Program Menu 1. ADD NEW Record 2. DISPLAY Record 3. MODIFY Record 4. EXIT Program please enter selection (1 - 4) : 3 Which record to MODIFY: Please choose one of the following... 1 to 2 : 2 Description: TEa Quantity: 30 Wholesale Price: $30.00 Retail Price: $40.00 Date: 03032018 Enter MODIFY Data: Desciption: TEa Powder Quantity: 10 Wholesale Price: $10 Retail Price: $15 Date Added: 03032017 Inventory Program Menu 1. ADD NEW Record 2. DISPLAY Record 3. MODIFY Record 4. EXIT Program please enter selection (1 - 4) : 2 Which Record to DISPLAY: Please choose one of the following... 1 to 2 : 2 Description: TEa Powder Quantity: 10 Wholesale Price: $10.00 Retail Price: $15.00 Date: 03032017 Inventory Program Menu 1. ADD NEW Record 2. DISPLAY Record 3. MODIFY Record 4. EXIT Program please enter selection (1 - 4) : 4 Thank you! Test CAse2: Inventory Program Menu 1. ADD NEW Record 2. DISPLAY Record 3. MODIFY Record 4. EXIT Program please enter selection (1 - 4) : 5 Please enter a valid choice (1 - 4): 4 Thank you! 

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

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions

Question

Understand the importance of strategic HR planning.

Answered: 1 week ago