Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a class (name it Product) with the following members: private: int itemNO, char code. public: default constructor (initializes the private members with default values),

Write a class (name it Product) with the following members: private: int itemNO, char code. public: default constructor (initializes the private members with default values), non-default constructor, get and set functions to get and set the private members.

a. Declare an array of type Product and size 4, fill the array with four objects of type product. Sort the array (ascending order) using the improved bubble sort algorithm based on the code of the product.

b. Declare a vector of type product (name it Vec), add six objects to the vector, and sort the vector (descending order) using the selection sort algorithm based on the item number.

c. Write two print functions to print the contents of the array and the vector.

d. Print the contents of the array and the vector before and after the sorting.

e. Use the Binary_Search algorithm to search the array for an object based on item number. Test the function with a driver program.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions

Question

What is Entrepreneur?

Answered: 1 week ago

Question

Which period is known as the chalolithic age ?

Answered: 1 week ago

Question

Explain the Neolithic age compared to the paleolithic age ?

Answered: 1 week ago