Question: Using C++ Write a C++ program to aid the DeAnza Bookstore in estimating its business for next quarter. Experience has shown that sales depend on
Using C++
Write a C++ program to aid the DeAnza Bookstore in estimating its business for next quarter. Experience has shown that sales depend on whether a book is required or suggested, and on whether or not it has been used before. A new, required book will sell to 90% (.90) of expected enrollment, but if it has been used before (and required) only 65% of the expected enrollment will buy it. Similarly, 40% of the expected enrollment will buy a newly suggested book, but only 20% will purchase a previously(used) suggested book.
INPUT:
Your program is to prompt the user for:
- the book's 10 digit ISBN number (store as a string)
- the list price per copy
- the expected class enrollment
- code of 'R' for required text or code of 'S' for suggested text
- code of 'N' for a new text or code of 'O' for an old (used) text that has been used the previous quarter
CALCULATE:
Calculate the number of copies needed and the profit if the store pays 80% of list price (use global #define for this). For the number of books to order, round to the nearest whole book quantity.Use one function to calculate number of books, one function to calculate the profit, and one function to output.
OUTPUT, A sample run might look like this:
Enter book number: 0755798652
Enter price per copy: 34.98
Enter expected class enrollment: 31
Enter 'R' if required or 'S' if suggested: r
Enter 'N' if new or 'O' if not a new text: O
ISBN: 0755798652
Copies Needed: __
Profit: $ ________
THEME ISSUES ( what you have learned and to be applied in this lab):
Functions (pass by value), if Constructs, character type, rounding
Checkpoints
1) Include file header w/ info about you and the program
2) Headers and comments for each function (read Module 3D under "Functions")
3) Use a globally defined constant for the rate of profit
4) Input may NOT be case sensitive. That is, if user enters r change it to R immediately, in your code. To do this use if(...) construct and assign uppercase value or you may use toupper() function (see 10.2 on page 545 of text). Only an error message should be output and nothing more if data is erroneous. Use exit() function as explained in 6.15 (p. 360).
5) A function must be used to calculate the number of books to be ordered. Round to the nearest whole number. Hint: static_cast
6) A function must be used to calculate the profit given the number of books and unit price.
7) One function must be used for all the output
8) Output must be formatted using dollar sign and 2 decimal place as shown above.
Test Data: Execute the program five times and each time copy and paste the output to the bottom of the program.
Set 1 0755798652, 34.98, 31, R, O
Set 2 3453456784, 23.95, 100, r, N
Set 3 5677655673, 54.50, 40, R, O
Set 4 2462462464, 5.95, 40,s,O
Set 5 8953647888, 65.99, 35, N, Y ; this is not a(my) typo
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
