Question: 1. Write a C++ program that reads book purchasing/order information from a file. There will be multiple lines in the file and each line in

1. Write a C++ program that reads book purchasing/order information from a file. There will be multiple lines in the file and each line in the file will represent the purchase of a book by a customer. Each customer will generally buy multiple copies of each book for their book club. Each line will contain the following information about the book: Customer ID Title Author ISBN Price Quantity Fiction/Non-Fiction Genre The file will contain ordering information for 4 or 5 different customers. Here is an example of the data (note the column headers will NOT be in the file): CUST_ID Title Author ISBN PRICE QUANTITY F_NF GENRE 1234 Dog Strategy Henry C. Moreno 3-598-21500-2 12.99 5 N M 6789 Companion Kicked Me Out Lorraine J. Johnson 3-598-21599-1 24.99 3 F R 3444 Mime On My Journey Kristy S. Wahl 3-699-21500-8 6.75 10 N D 4455 Damaged By The Joke Henry C. Christopher 3-598-21500-2 12.99 4 N R 2. Make use of the following data types: c++ string double int char bool 3. Additional Requirements: a) Assume the tax on the total price of the books is 7%. b) Shipping fee: If the quantity is over 20 Fee $50, 15-19: Fee $40, 10-14: Fee $30, 5-9: Fee $20, less than 5 Fee $10 c) Use and if/else or switch to determine the fee. d) Tax should not be calculated on the fees. e) A Boolean variable should be used to hold whether the book is Fiction or Non-Fiction. f) Use an if/else if statement to display the genre in the output. g) Do not apply fee to non-fiction romance. h) Accumulate total sales (without tax) of all invoices for this batch (file). i) Accumulate total number of books sold in this batch. j) Display the average book order sale. Do not use arrays for this project. Process one line at a time (read, accumulate, calculate, print to file). Take this project one step at a time: a) Loop through and read the data variables. b) Within your loop, next process a single line file. c) Still within your loop accumulate your total variables. d) Still within your loop write the invoice to the console. 4. Example Output Print Invoice (include the lines) to an invoice.txt file, you should have an entry like this for each unique customer id: __________________________________________________________________ Invoice Customer ID: 1234 Dog Strategy Non-Fiction Mystery 5@12.99 subtotal: 64.95 Total book sales: 64.95 Tax: 4.55 Subtotal: 69.50 Fee: 20.00 Total: 89.50 _________________________________________________________________ Now show the next customerComplete for all separate Customer IDs After all of the individual invoice display the report totals: _________________________________________________________________ REPORT TOTALS: Total Book Sales: 259.38 Average Book Sale: 64.85 _________________________________________________________________

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!