Question
C++ code URGENT!! The VP of Manufacturing, Silas Grump, calls you down to his large office with a desk on a slightly raised platform. He
C++ code URGENT!!
The VP of Manufacturing, Silas Grump, calls you down to his large office with a desk on a slightly raised platform. He looks down at you and says, "I heard you can program a little, kid. They sure do pay you computer guru types a lotta bucks!" Then he says, "But, what can you do for me? I need a program that when I type in a part number, it will come back with a report on the console like,
There are 11 of Part Number P-33195 in inventory.
It is a class C part.
The cost is $24.00.
The value of that inventory is $264.00.
Or, if I type in a part that aint on file, it should tell me that and Id like to be able to insert it into the list. I want it to put it exactly into the right spot, so it stays in order.
Then, it should keep on asking for more part numbers, until I say I don't want any more. You know all that info is on the parts.txt file.
After Im all done and say I dont want to search for any more part numbers, Id like a little report telling how many searches, how many were successful and how many new part numbers I added. And, it should write the file out again, so the additions are saved. Simple request for a hotshot programmer, aint it?
Back in your office you look up the file and find out it contains part number, part class, part on hand balance and part cost.
You also note that it is not in order. For sorting, you decide to use a shell sort, because every change to the order of parts needs to be reflected in all the other vectors. You couldnt do that if you used the sort function from
Search for three part numbers that are on the file and then search for and add the following part numbers:
P-10022 C 123 45.00
P-31977 A 12 156.00
P-32344 D 88 12.00
Functions required (Some of the prototypes will be different if you use a vector of structs):
// fills vectors
bool get_data (vector
// Does a binary search
int bin_search(string key, const vector
// Asks user for a part number to search for
string get_target();
// gets remaining info to add a part number
void get_more_data(char& class_in,int& part_ohb_in,double& part_cost_in);
// Inserts part number data into vectors into the proper location // See book for information on how to write this
void insert_data (vector
// Displays info on part number
void display (const vector
// sorts vectors (Calls swapper)
void sort (vector
// prints search stats
void print_stats(int searches, int good, int bad);
// writes out file when program ends, so additions are saved to file
void put_data (const vector
// templated swap function Swaps two items in a vector of any type // Put this BEFORE main() Called from sort function
template
void swapper (CType& a, CType & b)
{
CType temp; temp = a;
a = b;
b= temp;
}
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