Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a menu-driven program that updates the binary inventory file, inventory.dat. The file is composed of records based on the following structure: const int DESC_SIZE

Write a menu-driven program that updates the binary inventory file, inventory.dat. The file is composed of records based on the following structure:

const int DESC_SIZE = 40;

struct Product

{

long prodNum;

char prodName[DESC_SIZE];

double price; int qty;

};

Requirements 1. Use a menu-driven program that implements the following commands:

a. Display product inventory file

b. Display a particular product

c. Modify a product

d. Exit the program

2. Implement the following functions:

a. int showMenu();

Displays the menu Inputs the users selection Validates the users selection

b. void printFile (fstream&); Clear the eof flag Seek the first record (record 0) Use an eof loop to read the file into a Product record and display the fields to the screen Use a counter in your loop to count and display the record number

c. void displayRecord( fstream&); Input the users record number selection Clear the eof flag Seek the first record (record 0) Seek the indicated record number

Read the file and displays the product record to the screen

d. void modifyRecord (fstream&);

Input the users record number selection Input new values for the selected record number Clear the eof flag Seek the first record (record 0) Seek the indicated record number

Write the new values to file to replace the existing data

3. Main program uses a while loop with embedded switch statement to call appropriate functions based on menu choice.

4. All operations must access the file do NOT use an array.

5. Output must be labelled and easy to read.

6. Program must be documented with the following: Name, Date, Program Name, and Description.

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

More Books

Students also viewed these Databases questions