Question 7 A library charges a fine for book returned late as given below: [15] First Seven days 25 paise per day Eight to fifteen days 55 paise per day Above fifteen days 95 paise per day Design a Java program to calculate the fine assuming that a book is returned N days late. with steps
Answers
Answered by
4
Question:-
A library charges a fine for book returned late as given below: [15] First Seven days 25 paise per day Eight to fifteen days 55 paise per day Above fifteen days 95 paise per day Design a Java program to calculate the fine assuming that a book is returned N days late. with steps
Program:-
This is the required program.
import java.util.*;
class Fine
{
public static void main(String s[])
{
Scanner sc=new Scanner(System.in);
System.out.print("Enter the number of days: ");
int d=sc.nextInt();
int f=0;
if(d<=7)
f=25*d;
else if(d<=15)
f=55*d;
else
f=95*d;
System.out.println("Total fine in paise: "+f);
}
}
Similar questions