Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task: Create a hash table of a candy stores inventory. The table will be an array of structures. The program should permit price checks and

Task: Create a hash table of a candy stores inventory. The table will be an array of structures. The program should permit price checks and should allow item quantities to be increased or decreased.

Input: The tables data values will be read from a text file. The input file is La.txt. The program will initialize the table by using a hash function to place each structure in an appropriate array location. The data structure to use is:

struct Candy

{

string IDcode; // 4-char alphanumeric code

string itemName; // name/description of the candy

double quantity; // quantity on hand, in pounds

double price; // price per pound

};

You may decide on the array size. Create an appropriate hash calculation to assign each element into the array. Decide how collisions will be handled; for this assignment, use a method other than a linear probe.

Processing: Provide a menu for the user. Options should include:

availability check: is an item in stock (quantity > 0), and if so, what is its price?

purchase: decrement the quantity by some amount

delivery: increase the quantity

inventory: print the complete inventory to a hard copy report

------------------------------------------------------------------------------------------------

La.txt.

------------------------------------------------------------------------------------------------

C433 candy corn 10.0 1.15 C672 caramels 20.0 1.25 K761 chocolate kisses 22.0 2.95 F045 fudge 7.0 4.99 G123 gumballs 5.5 1.75 J004 jelly beans 30.0 1.19 L878 licorice 15.5 2.30 P767 peanut brittle 5.3 3.45 R117 raisin clusters 30.0 1.79 R068 rock candy 3.0 1.5 S030 seafoam 7.0 1.19 T555 truffles 12.0 8.99

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_2

Step: 3

blur-text-image_3

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

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

differentiate the function ( x + 1 ) / ( x ^ 3 + x - 6 )

Answered: 1 week ago

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago