Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Screenshot of the output required i AT&T 1:29 PM 85% Back Lab 5_BestSeller.docx Lab 5 Chapter 9: Using pointer notation and array notation Dynamic
C++
i AT&T 1:29 PM 85% Back Lab 5_BestSeller.docx Lab 5 Chapter 9: Using pointer notation and array notation Dynamic Memory Allocation (45 points) 1.) You are running a publishing company that tracks books sold by an author to determine how much to pay the author. The author is paid S0.45 for every book sold. The author is paid a bonus of S20,000 per book if a book is a best seller. However, the author fails to sell a minimum number of books, they forfeit $10,000 per book. This program calculates how much money to give to the author at the end of the year In main, ask the user how many different books they will be entering. (Input 8 when running the program). Validate the input for positive input. 2.) In main, dynamically allocate an array large enough to hold a user defined number of books. 3.) In main, fill an array with the number of books sold (in thousands). These values are input by the user. Validate input for the range of 0 to 2000 Test Data: 150 -500 360 1235 25 1800 699 2021 1750 2450 245 4.) Once all the book sales are entered into the array, the array should be passed to a function that calculates the amount of money to pay the author. The amount paid is the total number of books multiplied by the pay per book of S0.45 Remember, you entered the books in thousands sold, so you need to factor for that here. Here is the function header double totalPay (int* booksSold, int numBooks) //code to calculate and return the total 5.) In main, display the total amount paid for books sold with two numbers to the right of the decimal point. 6.) Then the array should be passed to a function that calculates the number of best sellers and the amount of bonus money. A best seller is any time a book sells more than 1.000.000 copies. Here is the function header: int howManyBS(int* booksSold, int numBooks) //code to calculate and return the number of best sellers.. USE ARRAY NOTATION Dashboard Calendar To Do Notifications Inbox Screenshot of the output required
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started