School of Computing & Information TechnologyCSCI251/CSCI851 Advanced ProgrammingAutumn 2020Assignment 3 (Worth 12%)Due 11:55pm Sunday 14th June 2020. (End of Week Thirteen)This assignment involves a Knapsack class containing a function template to add objects of varioussizes until the knapsack is near full.General notes1. Your assignment should be sensibly organised with the same kind of expectations in this area as theprevious assignments, although you can directly include the cpp this time since it’s templated.2. If your code fails to compile on capa with the instruction below you will likely receive zero.$ g++ A3.cpp libGenerate.a -o KAP3. Other than the initial command line input, the program should run without user input.4. You shouldn’t modify collect.h and you do not need to submit it.A knapsackKnapsack problems relate to resource allocation. There is not going to any attempt to optimise in thiscase, you just add objects as they arrive, if they fit. There is a collection of classes A to G, provided incollect.h and you will need to pass instances of them to a knapsack in the order they arrive, until thenext object cannot fit. You are to write a Knapsack class and the main to support and demonstrate thefunctionality required here. Your program should compile to KAP and run as:./KAP size seed• size : A positive integer. The size of the knapsack.• seed : A positive integer. Random seed to be passed to the generate function.A function generate(int) is prototyped in collect.h and defined in the library libGenerate.a. Itreturns a letter (char) that identifies which object you need to try and fit into your knapsack.You need to pass an object of that type to the knapsack using a function template/template functiondefined inside Knapsack. That function template should take an object of arbitrary type and attempt to1“add it” to the knapsack. If the object fits, based on the size using sizeof, you record that object as beingincluded, using the name attribute of the classes. The object itself should not be stored in the knapsack.Once the next object to be passed cannot be added to the knapsack, you should stop generating objectsand provide two reports:• Knapsack size, fill size, and a list of object types in the order added:Knapsack size: …Added object size: …BADACEGD• A list of object types in alphabetical order with the size of each type and the number of each included:A : size, 2B : size, 1C : size, 1D : size, 2E : size, 1G : size, 1Your reports shouldn’t reference classes that haven’t been added to the Knapsack and the Knapsack shouldnever specifically reference the A to G types in collect.h, or their sizes. The Knapsack class shouldsupport the use of other types that contain a char accessible through a getName() member function.Note that the collect.h and libGenerate.a can be changed for testing, so you shouldn’t hardcodesizes or attempt to predict the output from libGenerate.a. Some example output, based on specificinput, will be provided soon.Notes on submissionSubmission is via Moodle. Your code must compile on capa with the instructions you provide. If it doesn’tyou will likely be given zero for this assignment.Please submit your source, so .cpp and .h files, and makefile if you have one, in a zip fileA3.zip. There shouldn’t be any directory structure within the zip file. Please don’t submitcollect.h or libGenerate.a.1. The deadline is 11:55pm Sunday 14th June 2020.2. Late submissions will be marked with a 25% deduction for each day, including days over the weekend.3. Submissions more than three days late will not be marked, unless an extension has been granted.4. If you need an extension apply through SOLS, if possible before the assignment deadline.5. Plagiarism is treated seriously. Students involved will likely receive zero.© Luke McAven, SCIT-EIS-UOW, 2020.2
Quality and affordable writing services. Our papers are written to meet your needs, in a personalized manner. You can order essays, annotated bibliography, discussion, research papers, reaction paper, article critique, coursework, projects, case study, term papers, movie review, research proposal, capstone project, speech/presentation, book report/review, and more.
Need Help? Click On The Order Now Button For Help
What Students Are Saying About Us.......... Customer ID: 12*** | Rating: ⭐⭐⭐⭐⭐
"Honestly, I was afraid to send my paper to you, but splendidwritings.com proved they are a trustworthy service. My essay was done in less than a day, and I received a brilliant piece. I didn’t even believe it was my essay at first 🙂 Great job, thank you!"
.......... Customer ID: 14***| Rating: ⭐⭐⭐⭐⭐
"The company has some nice prices and good content. I ordered a term paper here and got a very good one. I'll keep ordering from this website."