Using visual studio C# Console App (.Net Framework):
Create a Console application for a library and name it FineForOverdueBooks. The Main () method asks the user to input the number of books that are overdue and the number of days they are overdue. Pass those values to a method 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.
1. Create a Console application. The Main () method, the user is prompted to enter the number of books that are overdue, and the number of days they are overdue.
2. Create a user-defined method to compute the fine for overdue books. This method will receive the number of overdue books and the number of days the books are overdue as parameters from the Main() method. Then this method will calculate the fine and display it.
3. Compile and test the program to make sure there is no syntax error.
Code -
using System;
class HelloWorld {
static void Main() {
//ask user to enter number of books
Console.WriteLine("Enter number of books that are overdue ");
int books = Convert.ToInt32(Console.ReadLine());
//ask user to enter number of days
Console.WriteLine("Enter number of days they are overdue ");
int days = Convert.ToInt32(Console.ReadLine());
//call function calculate fine
calculateFine(books,days);
}
private static void calculateFine(int books,int days){
int fine = 0;
//check if days are greater then 7
if(days>7)
fine = books*10*7 + books*20*(days-7);
//else calculate fine directly
else
fine = books*10*days;
Console.WriteLine("Fine"+fine);
}
}
Screenshots -

Using visual studio C# Console App (.Net Framework): Create a Console application for a library and...