Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program using c++ that reads the item number, cost and quantity for 25 items from a data file named parts.txt. The data for

Write a program using c++ that reads the item number, cost and quantity for 25 items from a data file named parts.txt. The data for each part is on a separate line, with values separated by spaces. Store the data in 3 parallel arrays, an array of integers for the item numbers, an array of floats or doubles for the prices, and an array of integers for the quantities.

Your program should sort the data in parallel, putting the item numbers into increasing order and keeping the prices and quantities in parallel with the item numbers. Print the sorted data to the monitor using cin and cout with setw, fixed, and setprecision to print the data in table format.

Your program should then enter a loop which: 1. Reads an item number from the user.

2. Displays the cost and quantity for that item, using a binary search algorithm.

3. Exits when an appropriate sentinel value is entered.

The program should be modular, with separate functions to read the data, sort, print the summary table, search, and print the results of a search.

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_2

Step: 3

blur-text-image_3

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

Beginning PostgreSQL On The Cloud Simplifying Database As A Service On Cloud Platforms

Authors: Baji Shaik ,Avinash Vallarapu

1st Edition

1484234464, 978-1484234464

More Books

Students also viewed these Databases questions

Question

List the advantages and disadvantages of the pay programs. page 505

Answered: 1 week ago