Question
A library charges late fees depending on the amount of days a book has been borrowed for. Books that are returned within 14 days or
A library charges late fees depending on the amount of days a book has been borrowed for.
-
Books that are returned within 14 days or less have no late fee.
-
Books borrowed between 15 and 28 days, the library charges a fee of $11.00.
-
Books that have been borrowed for 50 days or more days incur a late fee of $26.00.
-
For all other returned books, the library charges a late fee of $17.00.
Create a program that begins by reading the number of days a group of books have been borrowed for (as inputted by the user). The user will enter a -1 to indicate that there are no more books in the group. Then your program should display the total late fees for all books, total number of books in each category and the total number of books altogether. The cost should be displayed using two decimal places.
You may assume that the user input will be valid positive integers, except for the sentinel value.
Example program output:
Note: Underlined text in the sample output indicate user entered text.
Enter duration of book loan in days (-1 to finish): 10 Enter duration of book loan in days (-1 to finish): 22 Enter duration of book loan in days (-1 to finish): 15 Enter duration of book loan in days (-1 to finish): 33 Enter duration of book loan in days (-1 to finish): 30 Enter duration of book loan in days (-1 to finish): 78 Enter duration of book loan in days (-1 to finish): -1 ******Group Details****** early: 1 slightly_late: 2 late: 2 very_late: 1 Total: 6 ************************* Total late fees: $92.00
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