Class Record (Inventory System using Random File processing)
Posted by JanWan
Last Updated: November 29, 2012

Problem:>>

You are the owner of a hardware store and need to keep an inventory that can tell you what different tools you have, how many of each you have on hand, and the cost of each one.

Part 1

Implement the class Record that contains the following private and public members

private:

     int recordNum;

     char toolName [25];

     int quantity;

     double cost;

public:

     void setRecordNumber(int);

     int getRecordNumber() const;

     void setToolName(string);

     string getToolName() const;

     void setQuantity(int);

     int getQuantity() const;

     void setCost (double);

     double getCost() const;


Part 2

Write a program for the hardware store with the following functionalities (develop as a menu-driven application):

Function 1:  initializeFile

This function initializes the random-access file hardware.dat to 50 empty records.

Function 2: addDataToFile

This function allows the user to input data concerning each tool. See sample below

Record#

Tool name

Quantity

Cost

3

Electric sander

7

57.98

17

Hammer

76

11.99

24

Jig saw

21

11.00

Function 3: displayFileContent

This function will display the list of tools stored in the hardware.dat file.

Function 4: deleteRecordFromFile

This function will delete a record for a tool that you no longer have in stock.

Function 5: updateRecord

This function will be used to update the quantity on hand. If the hardware store sells an item, you should decrement the quantity, and vice versa, if new stocks are added. Make provisions for these transactions in this function.


J.W. PRODUCTION

Related Content
Simple Data Class using C++
Simple Data Class using C++
Samath | Jan 07, 2021
Account Class in C++
Account Class in C++
Samath | Jan 07, 2021
Car Class using C++
Car Class using C++
Samath | Jan 07, 2021
Circle Class in C++
Circle Class in C++
Samath | Jan 07, 2021
Invoice class using Java
Invoice class using Java
Samath | Jan 17, 2024
Movie Class in C++
Movie Class in C++
Samath | Jan 20, 2024
Rectangle Class in C++
Rectangle Class in C++
Samath | Jan 17, 2024
Movie Class in Java
Movie Class in Java
Samath | Jan 20, 2024
Student Class in Java
Student Class in Java
Samath | Jan 20, 2024
Glossary Class using Java
Glossary Class using Java
Samath | Jan 20, 2024
Vehicle Class using Java
Vehicle Class using Java
Samath | Jan 18, 2024
Phone Class using Java
Phone Class using Java
Samath | Jan 17, 2024
Airplane Class in Java
Airplane Class in Java
Samath | Jan 17, 2024