Write a function named “getCombinedPurchaseOrder” that accepts an array of PurchaseOrder object pointers, its size, description, and cost per item. It will go through the list in the array and return a pointer of a new PurchaseOrderobject that contains the total quantity of all the matched PurchaseOrderobjects(with the same description symbol and cost per item). It will return NULL if there is no match. For example, these 2 PurchaseOrderobjects with (100, 1.25, "A box of candy") and (200, 1.25, "A box of candy")will be combined into one new PurchaseOrderobjecthaving the quantity of 300. Please note that this function returns 2 separate values: the pointer to the newly created object and the number of matched PurchaseOrderobjects found in the list.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 28SA
icon
Related questions
Question

3. Write a function named “getCombinedPurchaseOrder” that accepts an array of PurchaseOrder object pointers, its size, description, and cost per item. It will go through the list in the array and return a pointer of a new PurchaseOrderobject that contains the total quantity of all the matched PurchaseOrderobjects(with the same description symbol and cost per item). It will return NULL if there is no match.

For example, these 2 PurchaseOrderobjects with (100, 1.25, "A box of candy") and (200, 1.25, "A box of candy")will be combined into one new PurchaseOrderobjecthaving the quantity of 300.

Please note that this function returns 2 separate values: the pointer to the newly created object and the number of matched PurchaseOrderobjects found in the list.

4. Write a function named “removeNegativePrice” that accepts the vector of pointers to PurchaseOrderobjects. It will go through that list and remove all PurchaseOrderobjectswiththenegativecost per item. It will also return how many PurchaseOrderobjects that it has removed from the list.

Please show how this function is being called and can delete PurchaseOrderobjects with negative cost from the list.

5. Write a function named “hasTwoQuestionMarks” that accepts parameters of the same as command-line arguments ( argc and argv ). It returns true if one of the arguments has a “??” character and false otherwise. If it has no argument, it will return false.

Once the “??” characters are found, please do not continue to the search.

Please note that you cannot use string class, string methods or any string function such as strlen. Please use only array notation, pointer to character, and/or pointer arithmetic and make use of the fact that this is a C-string.

Please write the main program that accepts argc and argv and pass them to this function and print out its result.

For example, if the arguments are“??two”,“one two??“ or “one t??o” it will return true and if it is“", “?”, “/?”or “one tw?o?”, it will return false.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning