Consider the following example showing the contents of two one-dimensional arrays that may be used in parallel. One array is used to store the identification numbers of products and another to store their corresponding prices. a) Define two one-dimensional arrays that may be used in parallel to store a maximum of 25 product IDs and prices. Use good and meaningful names. Assume that the product identification numbers and prices are already read and stored in the arrays which are partially filled, and the number of IDs read is stored in a variable numOfProducts. b) Write a value-returning function with the appropriate parameters, that uses linear search (sequential search) to search for a given product identification number and to determine whether it is found or not. If found, the position in the array where the product ID is found will be returned, otherwise -1 is returned. Proper indentation and alignment of the statements ia required. c) Write a segment of code to call the function in (b). Use the returned value of the position to output the product identification number and the price with the appropriate messages. An error message is displayed if a product was not found. Declare any variables used.
Consider the following example showing the contents of two one-dimensional arrays that may be used in parallel. One array is used to store the identification numbers of products and another to store their corresponding prices.
a) Define two one-dimensional arrays that may be used in parallel to store a maximum of 25 product IDs and prices. Use good and meaningful names.
Assume that the product identification numbers and prices are already read and stored in the arrays which are partially filled, and the number of IDs read is stored in a variable numOfProducts.
b) Write a value-returning function with the appropriate parameters, that uses linear search (sequential search) to search for a given product identification number and to determine whether it is found or not. If found, the position in the array where the product ID is found will be returned, otherwise -1 is returned. Proper indentation and alignment of the statements ia required.
c) Write a segment of code to call the function in (b). Use the returned value of the position to output the product identification number and the price with the appropriate messages. An error message is displayed if a product was not found.
Declare any variables used.
![Product
Identification (ID)
Price
10001
55.90
10002
234.88
10015
123.00
and more](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F5b846619-06dd-456e-bb07-602319994803%2F8a7c04cc-5645-411b-926a-6fa8c916c4ad%2F9sla94i_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)