
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
In C++ create a JSON parser, please leave meaningful comments explaining parts of the code.
![In the source file (CPP), create a C++ class that contains your functions and data members as follows:
• Data members:
· 2 arrays of strings named names and values respectfully (do not use STL containers e or your score will be
reduced significantly). The size of the arrays should be large enough to hold all of the data parsed from the
test files (we will be modifying this in the future so don't worry about the size being just right. Err on the side
of too large if anything).
• names array: will contain all of the names in the object
• values array: will contain all of the values in the object
Member functions:
· A function to open the file and store the file object or data. The function should return true on success and
false on failure.
· A function to read the names/values from the JSON file and place them in the 2 member arrays named
names and values respectfully. The function should return true on success and false on failure.
• Create docktest e testcases that tests the results of the parsing of JsonObject1.json L and JsonObject2.json L.
Here is an example:
/////// // Testing //////
TEST_CASE("Testing my JSON Parser")
{
JsonParser jp;
SUBCASE("testing parsing of empty JSON object")
{
// Open the file
CHECK(jp.OpenFile(DATA_FILE_PATH + "Jsonobjectl.json") == true);
// Invoke the parsing process
CHECK(jp.ParseJson() == true);
// Validate the parsed JSON object
CHECK(jp.names[0] == "");
CHECK(jp.values[0] == "");
}
SUBCASE("testing parsing of simple JSON object (only strings for values)")
{
// Open the file
CHECK(jp.OpenFile(DATA_FILE_PATH + "Jsonobject2.json") == true);
// Invoke the parsing process
CHECK(jp.ParseJson() == true);
// Validate the parsed JSON object
CHECK(jp.names[0] == "Name");
CHECK(jp.names[1] == "Symbol");
CHECK(jp.values[0]
CHECK(jp.values[1]
"BitCoin");
"BTC");
==](https://content.bartleby.com/qna-images/question/5e137e43-f349-4a58-82f7-e9d3080ca5f4/6e04b64e-48dc-44f4-b229-b6d29aefe243/3fro0nr_thumbnail.png)
Transcribed Image Text:In the source file (CPP), create a C++ class that contains your functions and data members as follows:
• Data members:
· 2 arrays of strings named names and values respectfully (do not use STL containers e or your score will be
reduced significantly). The size of the arrays should be large enough to hold all of the data parsed from the
test files (we will be modifying this in the future so don't worry about the size being just right. Err on the side
of too large if anything).
• names array: will contain all of the names in the object
• values array: will contain all of the values in the object
Member functions:
· A function to open the file and store the file object or data. The function should return true on success and
false on failure.
· A function to read the names/values from the JSON file and place them in the 2 member arrays named
names and values respectfully. The function should return true on success and false on failure.
• Create docktest e testcases that tests the results of the parsing of JsonObject1.json L and JsonObject2.json L.
Here is an example:
/////// // Testing //////
TEST_CASE("Testing my JSON Parser")
{
JsonParser jp;
SUBCASE("testing parsing of empty JSON object")
{
// Open the file
CHECK(jp.OpenFile(DATA_FILE_PATH + "Jsonobjectl.json") == true);
// Invoke the parsing process
CHECK(jp.ParseJson() == true);
// Validate the parsed JSON object
CHECK(jp.names[0] == "");
CHECK(jp.values[0] == "");
}
SUBCASE("testing parsing of simple JSON object (only strings for values)")
{
// Open the file
CHECK(jp.OpenFile(DATA_FILE_PATH + "Jsonobject2.json") == true);
// Invoke the parsing process
CHECK(jp.ParseJson() == true);
// Validate the parsed JSON object
CHECK(jp.names[0] == "Name");
CHECK(jp.names[1] == "Symbol");
CHECK(jp.values[0]
CHECK(jp.values[1]
"BitCoin");
"BTC");
==
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 3 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- True or False In C#, there are three types of comments: line comments, block comments, and documentation comments.arrow_forwardWhy is it that most languages do not specify the order in which the parameters to an operator or function are evaluated?arrow_forwardDestructor, copy constructor and operator= are special functions provided by C++. Group of answer choices True Falsearrow_forward
- Parameter passing in C is an alternative to using a global variable, but it comes with certain drawbacks.arrow_forwardYou are a member of a standardization committee for a new C++ standard, and there is a proposal on the table to drop C-strings from the language and support only the C++ string class. State whether you would oppose or support the proposal and explain why.arrow_forwardTypedef must be defined.arrow_forward
- Which of the following best describes the differences between read-only, constant, and non-constant variables in C#?arrow_forwardC++ Write a struct declaration for Animal which has three elements: a string for animal type, a string for color, and an integer for number of offspring. Then write the declaration for a structure variable of type Animal.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education