Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need working code for this please. I need working bakery.h and bakery.cpp plz. Part 1 (0%) The first portion of this workshop consists of
I need working code for this please. I need working bakery.h and bakery.cpp plz.
Part 1 (0%) The first portion of this workshop consists of modules: w7 (supplied) Bakery Enclose all your source code within the sods namespace and include the necessary guards in each header file. In the specs below, functions marked with DO NOT USE MANUAL LOOPS should not use for . range based for , while or do while in the implementation; these functions should use STL Algorithms. The STL Algorithms you choose should use lambda expressions to process the collection; the lambdas should capture the necessary variables from context only by value (the stream object is the only one allowed to be captured by reference). Check course notes to identify which algorithm is appropriate in each situation. Using manual loops will lead to rejection of the workshop or severe penalties (at the discretion of your professor). Bakery Module This module defines an enum class BakedTyped as follows: enum class BakedType{ BREAD, PASTERY and a simple structure called BakedGood , capable of storing the following information . Baked Type (either BREAD or PASTERY from the above enum) Description of the baked item The shelf life of the item in days . The amount of stock for the item The price of the item There is no need to add any member functions to this structure but additions can be included for ease of development. Choose appropriate types for each attribute if not provided. Lastly define a class called Bakery that manages a collection of objects of type BakedGood . Public Members for Bakery a custom constructor that receives as a parameter the name of the file containing the information about the BakedGoods to be added to the collection. If the filename is incorrect, this constructor should throw an exception. Each line from the file contains information about a single BakedGood in the following format: BakedType Description ShelfLife Stock Price The fields are not separated by delimiters; each field has a fixed size: o BakeType has a field size of 8 o Description has a field size of 20 o ShelfLife has a field size of 14 Stock has a field size of 8 o Price has a field size of 6 Any blank space at the begining/end of a token is not part of the token and should be removed. The read in BakedGood will populate the collection. void showGoods (std::astream& os) const : print the content of the collection into the parameter. Use the insertion operator (see below). DO NOT USE MANUAL LOOPS! Free HelpersFree Helpers std: :ostream& operator The price should be printed with two decimal place precision. Look in the sample output to see how the numbers should be formatted and the alignment of each field. Add any other private member that is required by your design! w7 Module (supplied) The tester module for the first portion has been supplied. Do not modify the existing code! When doing the workshop, you are encouraged to write your own tests, focusing on a single implemented feature at the time, until you get all functionality in place. Sample Output When the program is started with the command (the file bakery-goods. txt is provided): ws bakery-goods. txt the output should look like the one from the sample_output. txt file. Test Your Code To test the execution of your program, use the same data as shown in the output example above. Upload your source code to your matrix account. Compile and run your code using the latest version of the got compiler (available at /usr/local/gcc/10.2.0/bin/g#+ ) and make sure that everything works properly. Then, run the following command from your account (replace profname.proflastname with your professor's Seneca userid): profname. proflastname/submit 345_w7_pi and follow the instructions. This part represents a milestone in completing the workshop and is not marked! Part 2 (100%)Part 2 (100%) The second part of this workshop upgrades your solution to include more functionality in the Bakery module. A Important: Your solution should not use the same algorithm twice across two different functions/tasks listed below. Bakery Module Public Members void showGoods (std::ostream& os) const : update this function to display the total stock and price of the goods in the collection. See the sample output for the format. DO NOT USE MANUAL LOOPS! void sortBakery () : receives a parameter the name of the field used to sort the collection in ascending order. The parameter can have one of the values: Description , Shelf , stock . Price . DO NOT USE MANUAL LOOPS! std::vectorStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started