FineForOverdueBooks.cs Instructions Information Review Mode Project Help Downloa
ID: 3728984 • Letter: F
Question
FineForOverdueBooks.cs Instructions Information Review Mode Project Help Download Share 1 using Systen; 2 using static System.Console; 3 public class FineForOverdueBooks 4 5 public static votd Main() Create an application for a library and name it FineForOverdueBooks. The Main) 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 7 Write your main here Theme public static void DisplayFine(int books, int days) 9 10 11 12 13 Write your DisplayFine nethod here The library fine should be displayed in the following format: Keymap The fine for 2 book (s) for 3 day(s) is $0.60 Default Danger Area Reset Project (The numbers will vary based on the input.) GRADING As you complete the steps above, you can use the Test button to check if the lab tests are passing. Once you are satisfied with the results, use the Grade button to save your scoreExplanation / Answer
for calculating the amount check number of days and multiply with day ,amt and books.
Code:
using System;
using static System.Console;
public class FineForOverdueBooks
{
public 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;
if(days<8){
amt = books*days*0.10;
}
else{
amt = books*days*0.20;
}
Console.WriteLine("The fine for {0} book(s) for {1} day(s) is {2}",books,days,amt);
}
}
Sample Run:
Enter the number of books user checked out :
5
Enter the Number of overdue days :
5
The fine for 5 book(s) for 5 day(s) is 2.5
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.