Question
Super Shoe Store Program Design an algorithm that will load the shoe inventory from a file into a dynamically allocated database . The database will
Super Shoe Store Program
Design an algorithm that will load the shoe inventory from a file into a dynamically allocated database. The database will use a structure to store the shoe data. The pointers to each structure will be contained in a vector.
The structure definition should be able to store the following information:
Shoe Data | Data Values |
Shoe Type | Dress, Casual, Sandals, Sneakers, Boots |
Size | 6 through 12 including half sizes |
Width | A, B, D |
Color | White, Tan, Blue, Red, Black |
Quantity | 0 or more |
When the program begins display a welcome message. Prompt the user for the input filename. If the file does not open, display an error message.
The shoe inventory file is tab delimited with four fields: shoe type, size, width, color, and quantity. For each line in the input file, dynamically allocate memory for a new structure and add the pointer to that structure to your pointer vector. Once the entire file is loaded, close the input file.
The input file will be in the following format:
Dress 6 B Black 5
Boots 9 A Red 10
Sandals 6.5 B Blue 7
Sneakers 8.5 D White 20
The program data is in a text file called Shoes.txt. You can use this file to test your program. However, it should also work with other input files.
You should create and use functions for each of the following tasks:
- Open and read the file into the vector.
- Sort the vector data by shoe size (low-to-high).
- Display the output to the screen.
- Release the dynamically allocated memory.
Feel free to add any additional functions you think will improve your program.
Format your output like the example below:
Super Shoe Store Inventory Report
Shoe Type Size Width Color Quantity
--------------------------------------------------------
Dress 6 B Black 5
Sandals 6.5 B Blue 7
Sneaker 8.5 D White 20
Boots 9 A Red 10
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started