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
/// The name of the file containing the quiz.///
///
///
void ShowNextQuestion();///
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)


