Knowee
Questions
Features
Study Tools

Accept the number of days from the user and calculate the charge for library according to following:Till five days: Rs 2/daySix to ten days: Rs 3/day11 to 15 days: Rs 4/dayAfter 15 days: Rs 5/day

Question

Accept the number of days from the user and calculate the charge for library according to following:Till five days: Rs 2/daySix to ten days: Rs 3/day11 to 15 days: Rs 4/dayAfter 15 days: Rs 5/day

🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, here is a step-by-step guide on how to calculate the library charge based on the number of days:

  1. First, you need to get the number of days from the user. Let's denote this number as n.

  2. If n is less than or equal to 5, the charge is n * 2.

  3. If n is between 6 and 10, the charge for the first 5 days is 5 * 2 = 10, and the charge for the remaining days is (n - 5) * 3. So, the total charge is 10 + (n - 5) * 3.

  4. If n is between 11 and 15, the charge for the first 5 days is 5 * 2 = 10, the charge for the next 5 days is 5 * 3 = 15, and the charge for the remaining days is (n - 10) * 4. So, the total charge is 10 + 15 + (n - 10) * 4.

  5. If n is greater than 15, the charge for the first 5 days is 5 * 2 = 10, the charge for the next 5 days is 5 * 3 = 15, the charge for the next 5 days is 5 * 4 = 20, and the charge for the remaining days is (n - 15) * 5. So, the total charge is 10 + 15 + 20 + (n - 15) * 5.

Remember to replace n with the actual number of days.

This problem has been solved

Similar Questions

Create a class called library with data attributes like acc_number, publisher, titleand author. The methods of the class should includei). read() – acc_number, title, author.ii). compute() - to accept the number of days late, calculate and display the finecharged at the rate of $1.50 per day.iii). display the data

In a Library Management System, create a class ‘LibUser’ and get the name, age, address, book name, book type, date of issue, date of return (current date) and penalty amount. For ‘age’ create user defined exception class and check if age is a negative number and print “Please enter correct age”.Calculate the number of days of book in use as (current date - date of issue). If number of days of book in use is greater than 15 days and then handle the exception and print “Fine to be paid + Penalty amount”. Penalty amount = (number of days of book in use – 15) * 10.If the name entered contains numbers or any special characters (other than alphabets and spaces), then handle it using exception handling and print “Enter your Correct Name”.InputName (String)Age (Integer)address (String)book name (String)book type (String)date of issue (format: yyyy-mm-dd) (String)Current date (format: yyyy-mm-dd) (String)OutputUser defined string according to exception

In a Library Management System, create a class ‘LibUser’ and get the name, age, address, book name, book type, date of issue, date of return (current date) and penalty amount. For ‘age’ create user defined exception class and check if age is a negative number and print “Please enter correct age”.Calculate the number of days of book in use as (current date - date of issue). If number of days of book in use is greater than 15 days and then handle the exception and print “Fine to be paid”. Penalty amount = (number of days of book in use – 15) * 10.If the name entered contains numbers or any special characters (other than alphabets and spaces), then handle it using exception handling and print “Enter your Correct Name”.InputName (String)Age (Integer)address (String)book name (String)book type (String)date of issue (format: yyyy-mm-dd) (String)Current date (format: yyyy-mm-dd) (String)Penalty amount (Integer)OutputUser defined string according to exception

Tata Docomo charged Rs. 540 for 1GB(1 day)and Aircel charged 90% of Rs. 540 for the same 1GB for the same days. Gowri uses Docomo for 1st 15 days and the remaining 15 days uses Aircel. If she uses Aircel for the whole 30 days, how much amount she save?

A charge account had a balance of $972 on May 5. A purchase of $223 was made on May 17, and a payment of $125 was made on May 20. The interest on the average daily balance is 1.6% per month. Find the finance charge on the June 5 bill. (Round your answer to the nearest cent.)

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.