Ask Question
12 June, 17:03

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:

+5
Answers (1)
  1. 12 June, 18:51
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers