Write a C++ program for Books. Books data should be stored in three parallel 1D arrays. The first contains the book code, second contains the total number of sold books and the third one contains the price for each book. i) Write a function, called read that reads the book's information. ii) Create the function TotalPrice that would calculate the total price of each book. ii) Create the function print that prints all the books stored in the parallel arrays in a tabular format. Create the function findBestSellingBook that would return the code of the best- iv) selling book. v) Create the function findTotalsalesByCode that would return the total number of sold books of the passed code. If code does not exist, the function should return -1. In the main function, read the values of the parallel arrays using read, print the vi) arrays in a tabular format using print, and print the code of the best-selling book using findBestSellingBook. Also in the main, ask the user to enter a code, search for it using findTotalSalesByCode, and if the book is found, display the total number of sold books; otherwise, display an error message. vii) The output of your program might look similar to the example below (user input indicated in bold). Code Number of books Price Total 212 180 15 2700 213 400 10 4000 215 100 500 The code of the top selling book is: 213 Enter the code for the total number of sales of the book> 212 The total number of sales for book 212 is 180

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 44SA
icon
Related questions
Question

C++, functions and arrays (please don't use hard or high level code)

Write a C++ program for Books. Books data should be stored in three parallel 1D arrays. The
first contains the book code, second contains the total number of sold books and the third one
contains the price for each book.
Write a function, called read that reads the book's information.
i)
Create the function TotalPrice that would calculate the total price of each book.
ii)
iii)
Create the function print that prints all the books stored in the parallel arrays in a
tabular format.
iv)
selling book.
Create the function findTotal SalesByCode that would return the total number of
Create the function findBestSellingBook that would return the code of the best-
v)
sold books of the passed code. If code does not exist, the function should return -1.
In the main function, read the values of the parallel arrays using read, print the
vi)
arrays
in a tabular format using print, and print the code of the best-selling book
using findBestsellingBook:
Also in the main, ask the user to enter a code, search for it using
LindTotalsalesByCode, and if the book is found, display the total number of sold
books; otherwise, display an error message.
vii)
The output of your program might look similar to the example below (user input indicated in bold).
Code
Number of books Price
Total
212
180
15
2700
213
400
10
4000
215
100
500
The code of the top selling book is: 213
Enter the code for the total number of sales of the book> 212
The total number of sales for book 212 is 180
Transcribed Image Text:Write a C++ program for Books. Books data should be stored in three parallel 1D arrays. The first contains the book code, second contains the total number of sold books and the third one contains the price for each book. Write a function, called read that reads the book's information. i) Create the function TotalPrice that would calculate the total price of each book. ii) iii) Create the function print that prints all the books stored in the parallel arrays in a tabular format. iv) selling book. Create the function findTotal SalesByCode that would return the total number of Create the function findBestSellingBook that would return the code of the best- v) sold books of the passed code. If code does not exist, the function should return -1. In the main function, read the values of the parallel arrays using read, print the vi) arrays in a tabular format using print, and print the code of the best-selling book using findBestsellingBook: Also in the main, ask the user to enter a code, search for it using LindTotalsalesByCode, and if the book is found, display the total number of sold books; otherwise, display an error message. vii) The output of your program might look similar to the example below (user input indicated in bold). Code Number of books Price Total 212 180 15 2700 213 400 10 4000 215 100 500 The code of the top selling book is: 213 Enter the code for the total number of sales of the book> 212 The total number of sales for book 212 is 180
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage