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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education