I NEED YOU HELP FOR THE DIY PART OF THE WORKSHOP. THANK YOU! LAB…

Question Answered step-by-step I NEED YOU HELP FOR THE DIY PART OF THE WORKSHOP. THANK YOU! LAB… I NEED YOU HELP FOR THE DIY PART OF THE WORKSHOP. THANK YOU! LAB (50%)Shopping List is a program that keeps track of your shopping list up to 15 items. You can add items to the list, remove and check the items you bought. Also, you can remove all the checked items and clear the list.Here is a sample execution of the programLAB Execution example–>>> My Shopping List <<<--1-[ ]Oranges qty:(4)2-[ ]Apples qty:(4)3-[ ]Bananas qty:(10)4-[ ]Frozen Strawberries qty:(1)5-[X]Milk 3% qty:(2)6-[ ]Milk Skim qty:(1)7-[ ]Lundry Detergent liquic qty:(1)8-[ ]Lundry Detergent pods qty:(1)----------------------------1- Toggle bought Item2- Add Shopping Item3- Remove Shopping Item4- Remove bought Items5- Clear List0- Exit> 1Item number: 3–>>> My Shopping List <<<--1-[ ]Oranges qty:(4)2-[ ]Apples qty:(4)3-[X]Bananas qty:(10)4-[ ]Frozen Strawberries qty:(1)5-[X]Milk 3% qty:(2)6-[ ]Milk Skim qty:(1)7-[ ]Lundry Detergent liquic qty:(1)8-[ ]Lundry Detergent pods qty:(1)----------------------------1- Toggle bought Item2- Add Shopping Item3- Remove Shopping Item4- Remove bought Items5- Clear List0- Exit> 4Removing bought items, are you sure?(Y)es/(N)o: y–>>> My Shopping List <<<--1-[ ]Oranges qty:(4)2-[ ]Apples qty:(4)3-[ ]Frozen Strawberries qty:(1)4-[ ]Milk Skim qty:(1)5-[ ]Lundry Detergent liquic qty:(1)6-[ ]Lundry Detergent pods qty:(1)----------------------------1- Toggle bought Item2- Add Shopping Item3- Remove Shopping Item4- Remove bought Items5- Clear List0- Exit> 2Item name: Tooth PasteQuantity: 3–>>> My Shopping List <<<--1-[ ]Oranges qty:(4)2-[ ]Apples qty:(4)3-[ ]Frozen Strawberries qty:(1)4-[ ]Milk Skim qty:(1)5-[ ]Lundry Detergent liquic qty:(1)6-[ ]Lundry Detergent pods qty:(1)7-[ ]Tooth Paste qty:(3)----------------------------1- Toggle bought Item2- Add Shopping Item3- Remove Shopping Item4- Remove bought Items5- Clear List0- Exit> 0Step 1: Test the ProgramOn Windows, In Visual StudioOpen Visual Studio 2022 and create an Empty C++ Windows Console Project: Move the files w1p1.cpp and shoppinglist.csv into the project’s folder. Use Windows explorer to do this (or your favorite file manager). This step is important to keep all the files related to a project in a single place on disk.Add w1p1.cpp file to your project:Open Solution Explorer (click on View » Solution Explorer)Right-click on Source FilesSelect Add » Existing Item…Select w1p1.cpp from the file browserClick on OkRun the program by selecting Debug » Start Debugging or pressing the F5 key on your keyboard.On Linux, in your matrix accountConnect to Seneca with Global Protect VPNCreate a folder that will contain all your projects for this term’s work. Name it cpp_projects. Inside this folder create another folder named w1p1.Upload w1p1.cpp and shoppinglist.csv files into the ~/cpp_projects/w1p1.Using an ssh client (e.g., putty), go into that folder (cd ~/cpp_projects/w1p1) and compile the source file (see above for an explanation of the compilation command flags):g++ w1p1.cpp -Wall -std=c++11 -o wsRun and test the execution:wsStep 2: Create the ModulesUsing Visual Studio, in the Solution Explorer, add five new modules to your project:shoppingListApp – a module to hold the main() function and its relative functions and constant value (see below). This module should have only an implementation file (*.cpp).File – a module to hold the functions and global variables related to file processing. This module should have a header (*.h) and an implementation file (*.cpp).ShoppingList – a module to hold the direct shopping list related functions, global variables and constants. This module should have a header (*.h) and an implementation file (*.cpp).ShoppingRec – a module to hold the shopping record related functions, variables, constants and the ShoppingRec structure. This module should have a header (*.h) and an implementation file (*.cpp).Utils – a module to hold the general utility functions for the applications. This module may be moved to other workshops and assignments if needed. This module should have a header (*.h) and an implementation file (*.cpp).Header filesAdd File.h, ShoppingList.h, ShoppingRec.h and Utils.h to the project (in Solution Explorer, right-click on Header Files » Add » New Item and add a header file).Make sure you add the compilation safeguards and also have all the C++ code in the last four modules in a namespace called sdds.Compilation SafeguardsCompilation safeguards refer to a technique to guard against multiple inclusion of header files in a module. It does so by applying macros that check against a defined name:#ifndef «NAMESPACE»_«HEADERFILENAME»_H // replace with relevant names#define «NAMESPACE»_«HEADERFILENAME»_H// Your header file content goes here#endifIf the name isn’t yet defined, the #ifndef will allow the code to proceed onward to then define that same name. Following that the header is then included. If the name is already defined, meaning the file has been included prior (otherwise the name wouldn’t have been defined), the check fails, the code proceeds no further and the header is not included again.Compilation safeguards prevent multiple inclusions of a header in a module. They do not protect against including the header again in a different module (remember that each module is compiled independently from other modules).Additionally, see below an instructional video showing how the compiler works and why you need these safeguards in all of your header files. Do note that this video describes the intent and concept behind safeguards, the naming scheme isn’t the standard for our class. Follow the standard for safeguards as described in your class.Compilation Safeguards: https://www.youtube.com/watch?v=EGak2R7QdHoImplementation FilesAdd shoppingListApp.cpp, File.cpp, ShoppingList.cpp, ShoppingRec.cpp and Utils.cpp to the project (in Solution Explorer, right-click on Source Files » Add » New Item and add a C++ file).Step 3: The Main ModuleBecause it will contain the main() function, we will refer to shoppingListApp module as the main module.At the top of the file shoppingListApp.cpp, add these include and namespace statements:#include #include #include “File.h”#include “ShoppingList.h”#include “Utils.h”using namespace std;using namespace sdds;then add the definition of a constant:// set to false when compling on Linuxconst bool APP_OS_WINDOWS = true; From the code that has been provided to you, add the definition (implementation) of the following functions (with copy/paste):main()listMenu()This module doesn’t have a header file.Step 4: The Other ModulesWith copy/paste from the code provided, copy the functions into various modules, splitting them as describe below. Put the declaration of the function in headers and the definition in implementation files. Don’t forget to add the compilation safeguard to every header and to make sure that each compilation safeguard is unique in the entire project.The module ShoppingRec should contain:ShoppingRec custom type (struct)getShoppingRec()displayShoppingRec()toggleBoughtFlag()isShoppingRecEmpty()the constants MAX_QUANTITY_VALUE and MAX_TITLE_LENGTHThe module ShoppingList should contain:loadList()displayList()removeBoughtItems()removeItem()saveList()clearList()toggleBought()addItemToList()removeItemfromList()listIsEmpty()the constant MAX_NO_OF_RECSthe variables recs[] and noOfRecsThe module Utils should contain:flushkeys()ValidYesResponse()yes()readCstr()readInt()The module File should contain:openFileForRead()openFileForOverwrite()closeFile()freadShoppingRec()fwriteShoppintRec()the constant SHOPPING_DATA_FILE and the variable sfptrGuideline for Creating ModulesInclusionsAvoid unnecessary random includes and only include a header file in another file in which the header file functions are called or the header file definitions are used. A file should include everything it needs, and nothing more.Custom Types (struct definitions)Structure definitions must be kept in the header files to be visible to all the modules using it.Global VariablesGlobal variable must be in implementation files to be kept invisible to other modules. If you add global variables in header files, linking errors will occur.Global ConstantsThe constants are to be added to the file they are used in; if they are used in a header file, they must be added to the header file otherwise they must be added to the implementation file they are used in.Prefer const instead of #define for the rest of the term.NamespacesAll your code (in headers and implementation files) must be surrounded by the sdds namespace. The only function that is not to be added in a namespace is main() (C++ standard demands that main() must be in the global namespace).⛔Important: In the headers you can define only custom types and constants; the functions should only be declared in headers and defined in implementation files. Defining functions and variables in headers will (almost) always lead to linking errors (errors from the third stage of compilation). DIY (50%)In this part you are to create “Quizzer”: a program that loads multiple-choice/multiple-answer type of questions from a file, creates a quiz and shows it to the user. The user will see the question text, a list of possible answers to each question and make a choice about which answer is correct. At the end of the quiz, the program will print a score (how many of the user’s answers were correct).The Input FileThe questions for the quiz will be loaded from a text file. The file has a very well defined structure and you can assume that it will always be correct (no error checking is required for reading from the file).Each question looks like this:{mc} When a C program starts, the function that gets executed is called ________[ ] principal[X] main[ ] function[ ] func[ ] programThe question text will have exactly one line. The first characters will be{mc} – to signal a multiple-choice question (a question with exactly one correct answer){ma} – to signal a multiple-answer question (a question where multiple answers are correct)followed by a blank space and the text that will be presented to the user.After the question text, the file will contain the possible answers:[ ] – marks an incorrect answer[X] – marks a correct answerTwo consecutive questions will be separated by exactly two blank lines.The file can have maximum 60 questions. Each question can have maximum 10 answers. The text of a question can have maximum 1024 characters, and the text of an answer can have maximum 128 characters. Use these numbers when you design your code.Quiz ModuleCreate a module that contains any structures/functions/global variables that are useful when clients interact with a quiz. Your code must have at least the following (but you can add more, as your design requires):///

/// Loads a quiz from a file. If a quiz is already loaded, that quiz is discarded/// (together with any information regarding that previously loaded quiz).///

/// The name of the file containing the quiz./// 0 if the quiz was loaded, any other value if some error appeared/// (null parameter, empty parameter, missing file).int LoadQuiz(const char* filename);///

/// Checks if a quiz is currently loaded and is valid./// A quiz is considered valid if it has at least 5 questions/// and each question is correct (multiple-choice questions have/// exactly one correct answer, and multiple-answer questions/// have at least one correct answer./// /// For each question in the quiz, print to screen “Question X -> OK” or/// “Question X -> ERROR” if the question is valid or it contains some error./// /// If the quiz has an insufficient number of questions, this function prints nothing.///

/// 1 if the quiz is loaded and correct, 0 otherwiseint IsQuizValid();///

/// Checks if there are still questions in the quiz that haven’t been shown to the user.///

/// 1 if the quiz has more questions to show to the user; 0 otherwise.int HasMoreQuestions();///

/// Prints to the screen the next question from the quiz and records/// user’s answer. Once this function is called at least once,/// it is considered that the user took the quiz./// /// After the question is shown, this function will print “Your answer? “/// and read the user’s choice.///

void ShowNextQuestion();///

/// Prints to the screen the results in the format/// “QUIZ RESULTS: your score is X/Y.”./// /// If the user didn’t took the quiz, this function does nothing.///

void ShowQuizResults();Implement every function listed above in the namespace quizzer.Question moduleCreate a module named question that contains functionality related to a single question (e.g., to check if a question is valid, to check if an answer for a question is correct or not).HintsThe hints below are just guides; you can create a design that accomplishes the task using different features.Create a custom type (struct) to hold information about a question (type of question, text of the question, possible answers, which answer is correct, etc.).Create a custom type (struct) to hold information about a quiz (questions that are part of the quiz, current score the user has accumulated, which questions were shown and which weren’t, if the user took the quiz, etc.).Use arrays when you need to store a collection of objects of the same type.See which tasks must be performed multiple times; put that code in a function and call the function when needed.Keep the functions simple; a function should do only one thing. If a function becomes too long, break it into multiple simpler functions (a good rule of thumb is “a function should be at most a screen big”, so a reader doesn’t have to scroll to see the entire function).Use the provided sample output for hints about how to present the information to the user.Make sure you read and understand the provided code before implementing your solution.Check the C course for a refresh in file and string manipulation. Consider the following functions:std::fopen – https://en.cppreference.com/w/cpp/io/c/fclosestd::fclose – https://en.cppreference.com/w/cpp/io/c/fopenstd::fgets – https://en.cppreference.com/w/cpp/io/c/fgetsstd::fgetc – https://en.cppreference.com/w/cpp/io/c/fgetcstd::fscanf – https://en.cppreference.com/w/cpp/io/c/fscanfstd::scanf – https://en.cppreference.com/w/cpp/io/c/scanfstd::printf – https://en.cppreference.com/w/cpp/io/c/printfstd::strcpy – https://en.cppreference.com/w/cpp/string/byte/strcpystd::strncpy – https://en.cppreference.com/w/cpp/string/byte/strncpystd::strcmp – https://en.cppreference.com/w/cpp/string/byte/strcmpstd::strncmp – https://en.cppreference.com/w/cpp/string/byte/strcmpTester ProgramThe main module and the input files are provided. Read the code and make sure you understand it before attempting to implement anything. Do not change the existing code. If the program is implemented correctly, the output should look like the one from the sample_output.txt file.    Sample output can be found here:  https://github.com/Seneca-244200/OOP-Workshops/tree/main/WS01/DIY              Computer Science Engineering & Technology C++ Programming OOP 244 Share QuestionEmailCopy link Comments (0)