Write a program which calculates the library fine when the user inputs the number of days a book has been borrowed. The calculations will have to be made according to the following chart: First 12 days: Next 16 days: Next 28 days: No fine. Rs 5/- per day Rs 10/- per day Beyond 8 weeks: Rs 30/- per day
Answers
Answered by
0
Answer:
class Library
{
static void main(int d)
{
int n1, n2, n3;
n1 = 12;
n2 = 28;
n3 = 56;
int m1, m2, m3, m4;
m1 = 5;
m2 = 10;
m3 = 30;
int s1, s2, s3;
s1 = d*m1;
s2 = d*m2;
s3 = d*m3;
if(d <= n1){
System.out.println("No fine");
}
else if(d <= n2){
System.out.println("Your bill is $5 per day = $" + s1);
}
else if(d <= n3){
System.out.println("Your bill is $10 per day = $" + s2);
}
else if(d > n3){
System.out.println("Your bill is $30 per day = $" + s3);
}
}
}
//Hope it helps you
Similar questions
Math,
1 day ago
Hindi,
1 day ago
Math,
2 days ago
Biology,
8 months ago
Environmental Sciences,
8 months ago