CS300Fall19_Assignment3 CS 300 Data Structures Assignment-3 November 6, 2019 1 Due Date: Nov 18th XXXXXXXXXX:50pm (Monday) BARCODE SCANNER In this assignment, you are asked to design and develop a...

1 answer below »
Need it ASAP. C++ language required


CS300Fall19_Assignment3 CS 300 Data Structures Assignment-3 November 6, 2019 1 Due Date: Nov 18th 2019 11:50pm (Monday) BARCODE SCANNER In this assignment, you are asked to design and develop a Barcode reader application. You are provided with an input file with items with UPC code and description. The Universal Product Code (UPC) is a barcode symbology that is widely used for tracking trade items in stores. UPC consists of numeric digits, that are uniquely assigned to each trade item. The data is obtained from http://www.grocery.com/open-grocery-database-project/. You are going to read the file into binary search tree and allow user to search by a barcode. Here are the functional requirements of the application: - read file into binary search tree: parse the file content and store as product object in a binary search tree. Key is UPC code and Value is the description of the item - search by UPC code: application takes the UPC code as an input and prints the description of the product. - print the total time to complete the search - handle errors for invalid input, file not found Sample runs are provided below: Sample Run-1: UPC Code: 657622604842 Honest Tea Peach White Tea Lookup time: 1 miliseconds Sample Run-2: UPC Code: 071072030035 Coffee Espresso Decaf Lookup time: 10 miliseconds Sample Run-3: UPC Code: 1111 Not found CS 300 Data Structures Assignment-3 November 6, 2019 2 Hint: A sample code to read from a file. #include #include using namespace std; int main(){ string line; ifstream file; file.open("test.txt"); //file name is test.txt while(getline(file, line)){ //read each line into line string cout<> #include using namespace std; int main() { clock_t t; t = clock(); size_t size = 100000; int *pInt = new int[size]; //just for testing for(size_t i = 0; i < size;="" i++)="" randomizes="" an="" array="" pint[i]="rand();" t="clock()" -="" t;="" cout="">< "time:="" "="">< t="">< "="" miliseconds"="">< endl;="" cout="">< clocks_per_sec="">< "="" clocks="" per="" second"="">< endl;="" cout="">< "time:="" "="">< t*1.0/clocks_per_sec="">< "="" seconds"="">< endl; delete [] pint; return 0; } cs 300 data structures assignment-3 november 6, 2019 3 how to submit you are supposed to submit your source files (.cpp and .h files) as a single zip file via canvas and codepost. please use the following file format while naming the zip file: lastnamefirstnamex_y.zip where lastnamefirstname is your last name with the first letter in capital, followed by your first name with the first letter in capital; the x is the course code; the y is the assignment #. (ex: sercefatmacs300_3.zip) how to evaluate: the following rubric describes how your work will be evaluated. correctness (70 points) • [70] program is correct in object-oriented design and function; meets specification • [50] program output is correct but elements of specification missing, e.g. variable/method declarations. • [35] part of the specification has been implemented, e.g. one out of two required • subprograms. • [20] program has elements of correct code but does not assemble/compile. performance analysis and reporting (20 points) readability (10 points) • [10] programmer name and assignment present. sufficient comments to illustrate program logic. well-chosen identifiers. • [7] programmer name present, most sections have comments. fair choice of identifiers • [5] few comments, non-meaningful identifiers • [0] no programmer name. no comments. poor identifiers endl;="" delete="" []="" pint;="" return="" 0;="" }="" cs="" 300="" data="" structures="" assignment-3="" november="" 6,="" 2019="" 3="" how="" to="" submit="" you="" are="" supposed="" to="" submit="" your="" source="" files="" (.cpp="" and="" .h="" files)="" as="" a="" single="" zip="" file="" via="" canvas="" and="" codepost.="" please="" use="" the="" following="" file="" format="" while="" naming="" the="" zip="" file:="" lastnamefirstnamex_y.zip="" where="" lastnamefirstname="" is="" your="" last="" name="" with="" the="" first="" letter="" in="" capital,="" followed="" by="" your="" first="" name="" with="" the="" first="" letter="" in="" capital;="" the="" x="" is="" the="" course="" code;="" the="" y="" is="" the="" assignment="" #.="" (ex:="" sercefatmacs300_3.zip)="" how="" to="" evaluate:="" the="" following="" rubric="" describes="" how="" your="" work="" will="" be="" evaluated.="" correctness="" (70="" points)="" •="" [70]="" program="" is="" correct="" in="" object-oriented="" design="" and="" function;="" meets="" specification="" •="" [50]="" program="" output="" is="" correct="" but="" elements="" of="" specification="" missing,="" e.g.="" variable/method="" declarations.="" •="" [35]="" part="" of="" the="" specification="" has="" been="" implemented,="" e.g.="" one="" out="" of="" two="" required="" •="" subprograms.="" •="" [20]="" program="" has="" elements="" of="" correct="" code="" but="" does="" not="" assemble/compile.="" performance="" analysis="" and="" reporting="" (20="" points)="" readability="" (10="" points)="" •="" [10]="" programmer="" name="" and="" assignment="" present.="" sufficient="" comments="" to="" illustrate="" program="" logic.="" well-chosen="" identifiers.="" •="" [7]="" programmer="" name="" present,="" most="" sections="" have="" comments.="" fair="" choice="" of="" identifiers="" •="" [5]="" few="" comments,="" non-meaningful="" identifiers="" •="" [0]="" no="" programmer="" name.="" no="" comments.="" poor="">
Answered Same DayNov 09, 2021

Answer To: CS300Fall19_Assignment3 CS 300 Data Structures Assignment-3 November 6, 2019 1 Due Date: Nov 18th...

Ria answered on Nov 14 2021
131 Votes
#include
#include
#include
using namespace std;
// contruct a
binary search tree
typedef struct node
{
    string key;
    string value;
    struct node *left, *right;
}
node;
// create new node
node *new_node (string key, string value)
{
    node *t = (struct node *) malloc (sizeof (struct node));
    t->key = key;
    t->value = value;
    t->left = t->right = NULL;
    return t;
}
// insert new node into the BST
node *insert (node *node, string key, string value)
{
    if (node == NULL)
        return (new_node (key, value));
    else
    {
        if (key <= node->key)
            node->left = insert (node->left, key, value);
        else
            node->right = insert (node->right, key, value);
    }
    return node;
}
// BST searching
node* search (node* root, string key)
{
if (root->key ==...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here