Requirement is attached on the file. It is very urgent. Need to complete Catalog.h and Catalog.cpp. I will send the source files through email.
Unformatted Attachment Preview
CPSC-131 Project 3:
Universal Product Code (UPC) Catalog
This project is different from the previous two. In project 1, you were not allowed to use the
C++ Standard Library (SL); in project 2, you were allowed but not required to use the SL. In this
project, you are required to use the SL map, std::map, to apply this binary search tree to a real
The project files provide one class, Catalog, with member functions that you must complete
and which is expected to include the map.
Universal Product Code (UPC)
A Universal Product Code (UPC) has four parts but this project deals with only two of them:
category number and product number. Categories are groups of related products, such as books
or toys. They have numbers, which must be unique, and names, which dont have to be unique
but usually are. Each product in a category also has a number and a name. Product numbers must
be unique within a category but may be reused in separate categories. Product names, like
category names, dont have to be unique.
The project requires the design and implementation of an application program that creates an
catalog of UPCs for a store and provides access to that catalog. The catalog is loaded from a text
file that contains Category and Product records. Here is a sample:
78292 Books (Hard-cover)
Gone With The Wind
To Kill a Mockingbird
The Adventures of Tom Sawyer
Sleepytime Gal Barbie Collector Doll
Tonka Classic Mighty Dump Truck
Ambi Toys Chirpy Bird Whistle
Each category record has three fields: the Category tag, a number, and a name. They are
separated by tab characters (in C++, the tab character is represented by t); the format is
Each product record has two fields: number and name. They are separated by tab characters; the
format is number-tab-name.
Category and product names can have multiple words separated by spaces.
Category and product records may be in any order and may not be in a continuous sequence.
Classes and Functions
The program must have a Catalog class with the indicated functions:
1. AddCategory: Given a category number and name, add it to the catalog. It will have
an empty product list. Return false if the category number already exists in the catalog,
2. AddProduct: Given a category number, a product number, and a product name, add the
product to the catalog. Return false if the category number doesnt exist in the catalog or
if the product number already exists within the category, true otherwise.
3. GetCategoryCount: Return the number of categories in the catalog.
4. GetProductCount: Given a category number, return the number of products in the
category; return -1 if the category doesnt exist.
5. Load: Load the catalog from a file, given the files name. Return false if the catalog cant
be loaded, either because the file doesnt exist or isnt in the correct format.
6. ShowAll: Show the entire catalog, category by category, in order by category number.
Under each category, show its products in order by product number. Use the same format
as the text file in Load.
7. ShowCategory: Given a category number, show only its products in order by product
number. Return false if the category number doesnt exist in the catalog. Use the same
format as the text file in Load.
8. ShowProduct: Given a category number and a product number, show the product
number and name separated by a tab. Return false if the category number doesnt exist in
the catalog or if the product number doesnt exist within the category.
The output format of the three Show… functions should be the same as the input file format.
These functions are designed so that their caller specifies an output stream, which may be cout, a
file, or a stringstream. The prolog comments for each function explains more about output
You are to use the Standard Library (SL) map class (std::map) to hold catalog information. You
will find it necessary to use some SL container within the map to hold product information.
Remember that the nodes of a tree, which is the structure that the SL map implements, are
key/value pairs. The maps insert function takes a key and an associated data element, which can
be anything, including a class or structure. The class or structure can have anything as a member,
including any SL containereven another map.
These files will be posted on GitHub for you to download, use or modify, and submit:
? Catalog.h: contains declarations of the Catalog class. You may add other declarations as
needed for your implementation. Do not add definitions (code) to this file; definitions of
functions belong in catalog.cpp. [TO BE COMPLETED]
? Catalog.cpp: contains skeletons for the required member functions. You may add other
functions, member and nonmember, as needed for your implementation. [TO BE
? Main.cpp: contains a set of test functions that will call Catalogs functions. You may
modify this file for your own test purposes but use the original file to run your final test
before you submit your project.
These files are used by main.cpp to read test files. You should not change these files function
but you may use its functions in your code if you wish.
? GetLine.cpp and GetLine.h: contain a function similar to the Standard Librarys
getline(stream, string) function. This version handles the variety of line breaks that can
appear in text files, depending on the application that created them.
Two test files will be posted on GitHub for you to download: SmallCatalog.txt and
LargeCatalog.txt. They contain lists of categories and products. SmallCatalog.txts list is the
same as the one shown above in the Application section; LargeCatalog.txt contains over a dozen
categories and hundreds of products. Your final submittal will be tested using different files.
Two files will be posted on Titanium for your use:
? map.pdf, which describe SL classes of interest. It contains a brief description of the
relevant map functionsinsert, find, eraseincluding how to insert a key/value pair.
? stringparsing.pptx, which shows how to parse the fields of a string to extract them one at
a time. It describes how to find the beginning and end of fields that are separated by
characters such as tabs, and how to copy each field substring into another string.
? A more extension description of the SL map class and its functions can be found at
? To convert strings to numbers, you can use std::stoi()
? To split an input stream using a delimiter (such as the tab character), you can use
Obtaining and submitting code
We will again be using GitHub Classroom to distribute the skeleton code and collect your submissions.
Click the assignment link to fork your own copy of the skeleton code to your PC. One student from a
group clicks on the link below and forms a new team.
IMPORTANT: The team name must begin with your single digit section number (1-6).
For example: 2-Brians-team. Note that the entire project URL will then be of the form:
(the prefix project3- is automatically created).
This student then invites his/her project partner as an Outside collaborator in the settings menu.
Do not fork your repository to your personal github account (instructors have admin access to private
repositories). Your code should have a URL like
Assignment link: https://classroom.github.com/g/ZAjsirqK
(If you get an error when clicking the assignment link, chances are that your repository was still created
successfully. Check your github.com page and you will see you are a member of the
Here is a video that shows the steps: https://www.youtube.com/watch?v=-52quDR2QSc
Then edit your code locally as you develop it. As you make progress, commit and push your changes to
your repository regularly. This ensures that your work is backed up, and that you will receive credit for
making a submission. Dont wait until the deadline to learn how to push code!
The test platform is Linux with the clang++ -std=c++11 compiler. For this reason, the recommended
development platform is Linux. However, you can choose to use a different development environment as
long as you produce standards compliant C++ code that builds and runs on the test platform. Refer to the
Project 1 requirements document on how to set up your Windows or Linux development environment
You can check the results of automatic testing on Travis at https://travis-ci.com/ (same login as your
Your grade will be comprised of two parts, Form and Function.
Function refers to whether your code works properly as tested by the main function (80%).
Form refers to the design, organization, and presentation of your code. An instructor will read your code
and evaluate these aspects of your submission (20%).
The project will be submitted in two stages.
Stage 1 (Design):
Include the following information in a single PDF document and upload to Titanium.
? Names of all team members and their sections
? URL of github repository
? What will be the key and what will be the value of your map data structure
? Pseudocode (i.e an informal English outline of the processing steps) of member function
The Stage 1 deadline is Friday, April 13, 11:59 pm. This will not be graded – the purpose is to ask
for feedback on your design.
Stage 2 (C++ Implementation):
The project deadline is Monday, April 23, 11:59 pm.
Your code must compile/build for it to be tested and graded.
If you only complete part of the project, make sure that it compiles before submitting.
Purchase answer to see full
Why Work with Us
Top Quality and Well-Researched Papers
We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.
Professional and Experienced Academic Writers
We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.
Free Unlimited Revisions
If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.
Prompt Delivery and 100% Money-Back-Guarantee
All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.
Original & Confidential
We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.
24/7 Customer Support
Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.
Try it now!
How it works?
Follow these simple steps to get your paper done
Place your order
Fill in the order form and provide all details of your assignment.
Proceed with the payment
Choose the payment system that suits you most.
Receive the final file
Once your paper is ready, we will email it to you.
No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.
No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.
Admission Essays & Business Writing Help
An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.
Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.
If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.