Ask Question

Create an application for a library and name it FineForOverdueBooks. TheMain () method asks the user to input the number of books checked out and the number of days they are overdue. Pass those values to a method named DisplayFine that displays the library fine, which is 10 cents per book per day for the first seven days a book is overdue, then 20 cents per book per day for each additional day. The library fine should be displayed in the following format:

+4
Answers (1)
  1. 11 July, 07:41
    0
    using System. IO;

    using System;

    class FineForOverdueBooks

    {

    static void Main ()

    {

    Console. WriteLine ("Enter the number of books user checked out: ");

    int books = Convert. ToInt32 (Console. ReadLine ());

    Console. WriteLine ("Enter the number of overdue days: ");

    int days = Convert. ToInt32 (Console. ReadLine ());

    DisplayFine (books, days);

    }

    public static void DisplayFine (int books, int days) {

    double amt = 0;

    int d = days;

    if (days>7) {

    amt = (days-7) *.20 * books;

    days = 7;

    }

    if (days > 0) {

    amt = amt + days *.10 * books;

    }

    Console. WriteLine ("The fine for {0} book (s) for {1} day (s) is {2}", books, d, amt);

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Create an application for a library and name it FineForOverdueBooks. TheMain () method asks the user to input the number of books checked ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers